What is Leapcell Redis
Leapcell Redis is a Serverless Redis service that provides a fully serverless experience. Redis is an in-memory database used for caching and storing data. It supports a variety of data structures such as strings, lists, sets, sorted sets, and hash maps. Redis also provides features like persistence, publish-subscribe, and transactions.
Compatibility
Data Structure | Commands |
---|---|
String | append, decr, decrby, get, getex, getrange, getset, incr, incrby, incrbyfloat, set, setex, setnx, setrange, strlen |
Bitmap | bitcount, bitpos, getbit, setbit, bitop |
HashMap | hdel, hexists, hget, hgetall, hincrby, hincrbyfloat, hkeys, hlen, hmget, hmset, hset, hsetnx, hvals |
List | lindex, linsert, llen, lpop, lpush, lpushx, lrange, lrem, lset, ltrim, rpop, rpush, rpopcount, rpushx, lpos, rpoplpush |
Set | sadd, scard, sismember, smembers, srem, spop, srandmember, sinter, sinterstore, sunion, sunionstore, sdiff, sdiffstore, smismember, smove |
Sorted Set | zadd, zcard, zcount, zincrby, zrange, zrangebyscore, zrank, zrem, zremrangebyrank, zremrangebyscore, zrevrange, zrevrangebyscore, zrevrank, zscore, zlexcount, zrangebylex, zremrangebylex, zpopmax, zpopmin, zrandmember, zunion, zunionstore, zinterstore, zinter, zdiff, zdiffstore |
Architecture
The architecture of the Redis service is shown below:
Use Cases
Data Structure | Typical Use Cases |
---|---|
String | Redis strings are commonly used for caching small objects such as session tokens, user data, or configuration settings. Strings are also ideal for storing counters (e.g., tracking API usage or view counts) and managing rate limiting (e.g., API request limits). |
Bitmap | Bitmaps are well-suited for tracking binary states, such as monitoring user activity, attendance records, or feature flags. They are also used in analytics, such as click tracking or creating Bloom filters for set membership checks. |
HashMap | Hash maps are commonly used for storing user profiles (e.g., user attributes), caching objects with multiple fields (e.g., product details), or representing objects with attributes in key-value format, making them ideal for fast access to specific fields within an object. |
List | Redis lists are ideal for implementing queues (e.g., task processing or message queues), storing recent activity logs (e.g., last N actions), or implementing ordered lists such as leaderboards where data needs to be retrieved in a specific order. |
Set | Sets are used for managing unique collections, such as unique users, tags, or product categories. They are also useful for implementing membership checks (e.g., determining if a user has access to a specific feature) and performing set operations like intersection, union, or difference. |
Sorted Set | Sorted sets are used to manage ranked data, such as leaderboards or high score tracking. They are also useful for implementing time-based data (e.g., event logs or expiration of items) and storing sorted data for quick retrieval based on score or rank, making them ideal for applications that require quick lookups in sorted order. |