Skip to content
/ rimcu Public

Redis server-assisted client side caching Go library

License

Notifications You must be signed in to change notification settings

iwanbk/rimcu

Repository files navigation

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.