GithubHelp home page GithubHelp logo

iwanbk / rimcu Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 0.0 178 KB

Redis server-assisted client side caching Go library

License: MIT License

Go 99.86% Shell 0.05% Makefile 0.08%
go golang redis redis-client in-memory-caching resp3 resp3-client client-side-caching

rimcu's Introduction

rimcu - Redis server-assisted client side caching Go library

build workflow PkgGoDev codecov Maintainability

Rimcu is Go library for Redis server-assisted client side caching. In other words, it is a combination of Redis cient library and in memory cache library.

System Requirements

Redis 6 or newer, with it's client side caching feature

How it works

It caches the Redis data in your server's RAM and sync it to Redis server when the data changed. So you don't need to always ask the Redis server to get your cache data.

It supports three modes:

  • RESP2: single node Redis with RESP2 protocol, it is the default one
  • RESP2ClusterProxy: Redis cluster with RESP2 protocol and front proxy
  • RESP3: single node Redis with RESP3 protocol, not fully tested yet

Examples

Features

Features Status Description
Metrics Client โŒ ๐Ÿ”ง Configurable metrics client
Password Support โŒ ๐Ÿ”ง
Strings โŒ ๐Ÿ”ง redis strings data type
list โŒ ๐Ÿ”ง redis list data type
hash โŒ ๐Ÿ”ง redis hash data type

Connection Pool

Features Status Description
Single Pool โŒ ๐Ÿ”ง Single conn pool for all cache types
Vanilla Redigo Pool โŒ ๐Ÿ”ง Reuse vanilla redigo pool
Max Number of Connections โœ…
Waiting for connection with timeout โœ…
Idle connection checking โŒ ๐Ÿ”ง
Healthcheck โŒ ๐Ÿ”ง

Caches

We categorize the cache based on the Redis data types mention in https://redis.io/docs/manual/data-types/. We need to do this because each type of cache will be stored differently.

StringsCache

StringsCache is cache for redis strings data type.

Implemented Commands

  • Setex
  • Get
  • Del
  • MSet (waiting support at RESP2)
  • MGet (waiting support at RESP2)
  • Append

ListCache (RESP2)

IT IS UNDER REWORK

Old implementation can be found at https://github.com/iwanbk/rimcu/blob/v0.01/resp2/listcache.go#L33

ListCache is cache for Redis list data type which uses RESP2 protocol. It is still in very early development phase. See the godoc page for more explanation.
 
Implemented commands:
- [x]LPOP
- [x]RPUSH
- [x]GET (it is Rimcu specific command)
- [ ]...

Development

Local Test

export TEST_REDIS_ADDRESS=127.0.0.1:6379 # replace with your redis 6 server
go test ./...

TODO

Features Status Description
Unify inmem cache โŒ ๐Ÿ”ง resp2 & resp3 currently using two different memcache lib

CREDITS

  • redigo redis package is copied and modified to this repo. It is used to provide RESP2 support.

rimcu's People

Contributors

iwanbk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rimcu's Issues

Pool Enhancement

Proposal

Add new fields in pool struct that contains

  • min idle connection .
  • max active connection . if 0 unlimited. represent total connection
  • idle time out . for closing connection if idle for certain period.
  • active to identify active connections

In conn struct

  • add createdAt and lastUsedAt
  • create goroutine in pool to check obsolete connections by using above params

in get

  • check if connections is obsolete or not by using parameter idle timeout and send Do("PING") to redis.
  • if there is available connections in iddle connecitons, use it. otherwise create connection

in put

  • if active > maxActive, remove it
  • otherwise add it into iddle connections

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.