You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A high-performance Redis caching service built in Rust, providing a comprehensive REST API for 300+ Redis commands. Features include connection pooling, real-time streaming (SSE), WebSocket-based Pub/Sub, OpenAPI documentation, and capability-aware module support.
Repository Pattern β domain layer defines traits, infrastructure implements them against Redis
Service Layer β business logic, validation, and timeout enforcement in application services
Capability-Driven Routing β modules (JSON, Search, Bloom, TimeSeries) and features (Streams, Functions) are conditionally mounted based on detected Redis capabilities
Dedicated Pub/Sub Connections β subscriptions use separate connections, not the command pool
Bounded Blocking β all blocking commands (BLPOP, BRPOP, XREAD BLOCK, etc.) enforce a configurable max timeout
# Start the service with Redis 8
docker-compose up -d
# Check health
curl http://localhost:8080/health
# View Swagger UI
open http://localhost:8080/swagger-ui
# View logs
docker-compose logs -f caching-service
Running Locally
# Start Redis
docker-compose up -d redis
# Run the service
cargo run
# Or with release optimizations
cargo run --release
API Reference
Health Endpoints
Method
Endpoint
Description
GET
/health
Health check
GET
/health/ready
Readiness probe
GET
/health/live
Liveness probe
String Operations
Method
Endpoint
Description
GET
/api/v1/strings/{key}
Get string value
PUT
/api/v1/strings/{key}
Set string value
DELETE
/api/v1/strings/{key}
Get and delete (GETDEL)
POST
/api/v1/strings/mget
Get multiple keys
POST
/api/v1/strings/mset
Set multiple keys
PATCH
/api/v1/strings/{key}/incr
Increment value
PATCH
/api/v1/strings/{key}/decr
Decrement value
PATCH
/api/v1/strings/{key}/append
Append to value
GET
/api/v1/strings/{key}/length
Get string length
GET
/api/v1/strings/{key}/range
Get substring
PATCH
/api/v1/strings/{key}/range
Set substring
GET
/api/v1/strings/{key}/getex
Get with TTL update
POST
/api/v1/strings/lcs
Longest common subsequence (Redis 7+)
Hash Operations
Method
Endpoint
Description
GET
/api/v1/hashes/{key}
Get all fields (HGETALL)
PUT
/api/v1/hashes/{key}
Set fields (HSET)
GET
/api/v1/hashes/{key}/fields/{field}
Get field value (HGET)
POST
/api/v1/hashes/{key}/set-nx
Set field if not exists (HSETNX)
POST
/api/v1/hashes/{key}/fields/get
Get multiple fields (HMGET)
DELETE
/api/v1/hashes/{key}/fields
Delete fields (HDEL)
GET
/api/v1/hashes/{key}/fields/{field}/exists
Check field exists (HEXISTS)
GET
/api/v1/hashes/{key}/keys
Get field names (HKEYS)
GET
/api/v1/hashes/{key}/values
Get field values (HVALS)
GET
/api/v1/hashes/{key}/length
Get field count (HLEN)
PATCH
/api/v1/hashes/{key}/fields/{field}/incr
Increment field (HINCRBY)
PATCH
/api/v1/hashes/{key}/fields/{field}/incr-float
Increment float (HINCRBYFLOAT)
GET
/api/v1/hashes/{key}/fields/{field}/length
Get field string length (HSTRLEN)
GET
/api/v1/hashes/{key}/random
Get random field (HRANDFIELD)
GET
/api/v1/hashes/{key}/scan
Scan fields (HSCAN)
Hash Field Expiration (Redis 7.4+):
Method
Endpoint
Description
POST
/api/v1/hashes/{key}/fields/expire
Set field expiry in seconds (HEXPIRE)
POST
/api/v1/hashes/{key}/fields/pexpire
Set field expiry in ms (HPEXPIRE)
POST
/api/v1/hashes/{key}/fields/expireat
Set field expiry as unix timestamp (HEXPIREAT)
POST
/api/v1/hashes/{key}/fields/pexpireat
Set field expiry as unix ms timestamp (HPEXPIREAT)
POST
/api/v1/hashes/{key}/fields/expiretime
Get field expiry time (HEXPIRETIME)
POST
/api/v1/hashes/{key}/fields/pexpiretime
Get field expiry ms time (HPEXPIRETIME)
POST
/api/v1/hashes/{key}/fields/ttl
Get field TTL in seconds (HTTL)
POST
/api/v1/hashes/{key}/fields/pttl
Get field TTL in ms (HPTTL)
POST
/api/v1/hashes/{key}/fields/persist
Remove field expiry (HPERSIST)
Redis 8.0+ Hash Commands:
Method
Endpoint
Description
POST
/api/v1/hashes/{key}/getex
Get fields with expiry update (HGETEX)
POST
/api/v1/hashes/{key}/setex
Set fields with expiry (HSETEX)
POST
/api/v1/hashes/{key}/getdel
Get and delete fields (HGETDEL)
List Operations
Method
Endpoint
Description
POST
/api/v1/lists/{key}/lpush
Push to head (LPUSH)
POST
/api/v1/lists/{key}/rpush
Push to tail (RPUSH)
POST
/api/v1/lists/{key}/lpushx
Push to head if exists (LPUSHX)
POST
/api/v1/lists/{key}/rpushx
Push to tail if exists (RPUSHX)
POST
/api/v1/lists/{key}/lpop
Pop from head (LPOP)
POST
/api/v1/lists/{key}/rpop
Pop from tail (RPOP)
GET
/api/v1/lists/{key}/range
Get range (LRANGE)
GET
/api/v1/lists/{key}/length
Get length (LLEN)
GET
/api/v1/lists/{key}/index
Get by index (LINDEX)
PATCH
/api/v1/lists/{key}/set
Set by index (LSET)
POST
/api/v1/lists/{key}/insert
Insert element (LINSERT)
DELETE
/api/v1/lists/{key}/remove
Remove elements (LREM)
POST
/api/v1/lists/{key}/trim
Trim list (LTRIM)
GET
/api/v1/lists/{key}/pos
Find element position (LPOS)
POST
/api/v1/lists/move
Move element between lists (LMOVE)
POST
/api/v1/lists/rpoplpush
Pop and push (RPOPLPUSH)
POST
/api/v1/lists/mpop
Pop from multiple lists (LMPOP)
Blocking Operations (return 204 on timeout):
Method
Endpoint
Description
POST
/api/v1/lists/blpop
Blocking left pop (BLPOP)
POST
/api/v1/lists/brpop
Blocking right pop (BRPOP)
POST
/api/v1/lists/blmove
Blocking move (BLMOVE)
POST
/api/v1/lists/brpoplpush
Blocking pop and push (BRPOPLPUSH)
POST
/api/v1/lists/blmpop
Blocking multi-pop (BLMPOP)
SSE Streaming (real-time blocking via Server-Sent Events):
Method
Endpoint
Description
GET
/api/v1/lists/{key}/blpop/stream
Stream repeated BLPOP results
GET
/api/v1/lists/{key}/brpop/stream
Stream repeated BRPOP results
GET
/api/v1/lists/blmpop/stream
Stream repeated BLMPOP results
Set Operations
Method
Endpoint
Description
POST
/api/v1/sets/{key}/members
Add members (SADD)
DELETE
/api/v1/sets/{key}/members
Remove members (SREM)
GET
/api/v1/sets/{key}/members
Get all members (SMEMBERS)
POST
/api/v1/sets/{key}/ismember
Check membership (SISMEMBER)
POST
/api/v1/sets/{key}/mismember
Check multiple members (SMISMEMBER)
GET
/api/v1/sets/{key}/card
Get cardinality (SCARD)
GET
/api/v1/sets/{key}/random
Random members (SRANDMEMBER)
POST
/api/v1/sets/{key}/pop
Pop random members (SPOP)
POST
/api/v1/sets/move
Move member between sets (SMOVE)
POST
/api/v1/sets/inter
Intersection (SINTER)
POST
/api/v1/sets/interstore
Intersection and store (SINTERSTORE)
POST
/api/v1/sets/intercard
Intersection cardinality (SINTERCARD)
POST
/api/v1/sets/union
Union (SUNION)
POST
/api/v1/sets/unionstore
Union and store (SUNIONSTORE)
POST
/api/v1/sets/diff
Difference (SDIFF)
POST
/api/v1/sets/diffstore
Difference and store (SDIFFSTORE)
GET
/api/v1/sets/{key}/scan
Scan members (SSCAN)
Sorted Set Operations
Method
Endpoint
Description
POST
/api/v1/sorted-sets/{key}/members
Add members with scores (ZADD)
DELETE
/api/v1/sorted-sets/{key}/members
Remove members (ZREM)
POST
/api/v1/sorted-sets/{key}/incr
Add with increment (ZADD INCR)
GET
/api/v1/sorted-sets/{key}/score/{member}
Get score (ZSCORE)
POST
/api/v1/sorted-sets/{key}/mscore
Get multiple scores (ZMSCORE)
POST
/api/v1/sorted-sets/{key}/incrby
Increment score (ZINCRBY)
GET
/api/v1/sorted-sets/{key}/card
Get cardinality (ZCARD)
POST
/api/v1/sorted-sets/{key}/count
Count in score range (ZCOUNT)
POST
/api/v1/sorted-sets/{key}/lexcount
Count in lex range (ZLEXCOUNT)
GET
/api/v1/sorted-sets/{key}/rank/{member}
Get rank (ZRANK)
GET
/api/v1/sorted-sets/{key}/revrank/{member}
Get reverse rank (ZREVRANK)
GET
/api/v1/sorted-sets/{key}/range
Get range (ZRANGE)
POST
/api/v1/sorted-sets/{key}/rangebyscore
Get by score range (ZRANGEBYSCORE)
POST
/api/v1/sorted-sets/{key}/rangebylex
Get by lex range (ZRANGEBYLEX)
POST
/api/v1/sorted-sets/{key}/rangestore
Store range result (ZRANGESTORE)
POST
/api/v1/sorted-sets/{key}/remrangebyrank
Remove by rank range (ZREMRANGEBYRANK)
POST
/api/v1/sorted-sets/{key}/remrangebyscore
Remove by score range (ZREMRANGEBYSCORE)
POST
/api/v1/sorted-sets/{key}/remrangebylex
Remove by lex range (ZREMRANGEBYLEX)
POST
/api/v1/sorted-sets/{key}/popmin
Pop min score members (ZPOPMIN)
POST
/api/v1/sorted-sets/{key}/popmax
Pop max score members (ZPOPMAX)
GET
/api/v1/sorted-sets/{key}/random
Random members (ZRANDMEMBER)
POST
/api/v1/sorted-sets/union
Union (ZUNION)
POST
/api/v1/sorted-sets/unionstore
Union and store (ZUNIONSTORE)
POST
/api/v1/sorted-sets/inter
Intersection (ZINTER)
POST
/api/v1/sorted-sets/interstore
Intersect and store (ZINTERSTORE)
POST
/api/v1/sorted-sets/intercard
Intersection cardinality (ZINTERCARD)
POST
/api/v1/sorted-sets/diff
Difference (ZDIFF)
POST
/api/v1/sorted-sets/diffstore
Diff and store (ZDIFFSTORE)
GET
/api/v1/sorted-sets/{key}/scan
Scan members (ZSCAN)
POST
/api/v1/sorted-sets/zmpop
Pop from multiple sets (ZMPOP)
Blocking Operations (return 204 on timeout):
Method
Endpoint
Description
POST
/api/v1/sorted-sets/bzpopmin
Blocking pop min (BZPOPMIN)
POST
/api/v1/sorted-sets/bzpopmax
Blocking pop max (BZPOPMAX)
POST
/api/v1/sorted-sets/bzmpop
Blocking multi-pop (BZMPOP)
SSE Streaming:
Method
Endpoint
Description
GET
/api/v1/sorted-sets/{key}/bzpopmin/stream
Stream BZPOPMIN results
GET
/api/v1/sorted-sets/{key}/bzpopmax/stream
Stream BZPOPMAX results
Bitmap Operations
Method
Endpoint
Description
GET
/api/v1/bitmaps/{key}/bit/{offset}
Get bit value (GETBIT)
PUT
/api/v1/bitmaps/{key}/bit/{offset}
Set bit value (SETBIT)
GET
/api/v1/bitmaps/{key}/count
Count set bits (BITCOUNT)
GET
/api/v1/bitmaps/{key}/pos
Find first bit (BITPOS)
POST
/api/v1/bitmaps/operations
Bitwise operations (BITOP)
POST
/api/v1/bitmaps/{key}/bitfield
Bitfield operations (BITFIELD)
POST
/api/v1/bitmaps/{key}/bitfield/ro
Read-only bitfield (BITFIELD_RO)
Geospatial Operations
Method
Endpoint
Description
POST
/api/v1/geo/{key}
Add members (GEOADD)
POST
/api/v1/geo/{key}/pos
Get positions (GEOPOS)
GET
/api/v1/geo/{key}/dist/{member1}/{member2}
Get distance (GEODIST)
POST
/api/v1/geo/{key}/hash
Get geohashes (GEOHASH)
POST
/api/v1/geo/{key}/search
Search area (GEOSEARCH)
POST
/api/v1/geo/{dest_key}/searchstore
Search and store (GEOSEARCHSTORE)
GET
/api/v1/geo/{key}/radius
Search by radius (GEORADIUS, legacy)
GET
/api/v1/geo/{key}/radius/{member}
Search around member (GEORADIUSBYMEMBER, legacy)
HyperLogLog Operations
Method
Endpoint
Description
POST
/api/v1/hll/{key}/add
Add elements (PFADD)
POST
/api/v1/hll/count
Estimate cardinality (PFCOUNT)
POST
/api/v1/hll/{key}/merge
Merge sets (PFMERGE)
Key Operations
Method
Endpoint
Description
POST
/api/v1/keys/delete
Delete multiple keys (DEL/UNLINK)
POST
/api/v1/keys/exists
Check if keys exist (EXISTS)
POST
/api/v1/keys/touch
Update access time (TOUCH)
GET
/api/v1/keys/scan
Scan keys with pattern (SCAN)
GET
/api/v1/keys
List keys matching pattern (KEYS)
GET
/api/v1/keys/random
Get random key (RANDOMKEY)
GET
/api/v1/keys/{key}
Get key info (TYPE, TTL, OBJECT)
DELETE
/api/v1/keys/{key}
Delete single key (UNLINK)
GET
/api/v1/keys/{key}/ttl
Get TTL
PATCH
/api/v1/keys/{key}/expire
Set expiration (EXPIRE/PEXPIRE)
PATCH
/api/v1/keys/{key}/persist
Remove expiration (PERSIST)
GET
/api/v1/keys/{key}/type
Get key type (TYPE)
PATCH
/api/v1/keys/{key}/rename
Rename key (RENAME/RENAMENX)
POST
/api/v1/keys/{key}/copy
Copy key (COPY)
GET
/api/v1/keys/{key}/dump
Serialize key (DUMP)
POST
/api/v1/keys/{key}/restore
Deserialize key (RESTORE)
GET
/api/v1/keys/{key}/object
Object encoding/refcount/idletime
POST
/api/v1/keys/{key}/sort
Sort key (SORT)
POST
/api/v1/keys/{key}/sort/store
Sort and store (SORT ... STORE)
POST
/api/v1/keys/{key}/sort/readonly
Read-only sort (SORT_RO)
Stream Operations
Requires Redis 5.0+. Conditionally enabled based on detected capabilities.