Skip to content

Minimal key-value store written using async Python. Inspired by Redis.

License

Notifications You must be signed in to change notification settings

avanishd-3/simple-cache

Repository files navigation

simple-cache

Non-persistent, minimal key-value store inspired by Redis. Uses Python asyncio event loop to manage clients.

The only dependency is snakeviz, which is for visualizing profiling data. The server has no dependencies and can be run without uv. See: server shell script.

simple-cache uses RESP 2, so using Redis clients like redis-cli and language-specific Redis SDKs should work, though I've only tested with redis-cli.

The supported commands and their differences compared to the Redis versions are outlined below.

Supported Commands

Basic commands
Command Deviation from Redis
PING None
ECHO None
TYPE Only supports strings, lists, streams, and sets
EXISTS None
DEL None
String commands
Command Deviation from Redis
SET These optional arguments are not supported:
NX
XX
GET
GET None
List commands
Command Deviation from Redis
RPUSH None
LPUSH None
LLEN None
LRANGE None
LPOP None
BLPOP Does not support blocking on multiple lists at a time

Timeout is 0 if not specified
Stream commands
Command Deviation from Redis
XADD No optional arguments supported
XRANGE None
Set commands
Command Deviation from Redis
SADD None
SCARD None
SDIFF None
SDIFFSTORE None
SINTER None
SINTERSTORE None
SUNION None
SUNIONSTORE None
SISMEMBER None
SMEMBERS None
SMOVE None
SREM None
Transaction commands
Command Deviation from Redis
INCR None
Other commands
Command Deviation from Redis
FLUSHDB None
SHUTDOWN No optional arguments supported

Does not fail b/c no saving to disk

Signal handling not implemented
TTL None
EXPIRE None

Configuration Options

  • Port: Pass --port flag with port number to shell script to change port simple cache uses. The default port is 6379, just like Redis.
  • Debug: Pass --debug flag to enable debug mode. Debug mode logs command handling and variable state.

Run Tests

  • By default, the test shell script runs both unit and integration tests. Pass -u to run only unit tests or -i to run only integration tests.

About

Minimal key-value store written using async Python. Inspired by Redis.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published