SBCache - High-Performance In-Memory Cache Server
Project description
SBCache - High-Performance In-Memory Cache Server
Fast. Simple. Reliable.
SBCache is a modern in-memory cache server designed for speed, simplicity, and developer productivity. Inspired by Redis, SBCache provides key-value storage, TTL expiration, persistence, and client libraries for modern applications.
Features
- High Performance - Built with asyncio for high concurrency
- In-Memory Storage - Blazing fast key-value operations
- TTL & Expiration - Automatic key expiration
- Rich Data Types - Strings, Hashes, Lists, Sets, Sorted Sets
- Persistence - Snapshot (RDB) and AOF support
- Monitoring - Real-time statistics
Quick Start
Installation
pip install sbcache
Start Server
sbcached start sbcached start -H 127.0.0.1 -p 6379 --max-memory 1024 --eviction lru
Use Python Client
from sbcache.sdk.python.client import SBCacheClient
client = SBCacheClient("localhost", 6379)
String operations
client.set("name", "SBCache") client.set("temp", "value", ex=60) value = client.get("name")
Hash operations
client.hset("user:1", "name", "Alice") client.hset("user:1", "age", 30) user = client.hgetall("user:1")
List operations
client.lpush("queue", "task1", "task2") task = client.rpop("queue")
Set operations
client.sadd("tags", "python", "cache") tags = client.smembers("tags")
Sorted Set operations
client.zadd("scores", 100, "player1") scores = client.zrangebyscore("scores", 90, 100)
Admin
stats = client.stats() info = client.info() client.flush()
client.close()
Use CLI
Interactive mode
sbcache-cli
Single command
sbcache-cli -c "PING" sbcache-cli -c "SET name SBCache" sbcache-cli -c "GET name" sbcache-cli -c "STATS"
Use Telnet
telnet localhost 6379 PING SET name SBCache GET name STATS QUIT
Supported Commands
| Category | Commands |
|---|---|
| Strings | SET, GET, DEL, EXISTS, EXPIRE, TTL, INCR, DECR, KEYS, MGET, MSET |
| Hashes | HSET, HGET, HDEL, HGETALL, HEXISTS, HLEN |
| Lists | LPUSH, RPUSH, LPOP, RPOP, LRANGE, LLEN, LINDEX |
| Sets | SADD, SREM, SMEMBERS, SISMEMBER, SCARD |
| Sorted Sets | ZADD, ZSCORE, ZRANGEBYSCORE, ZRANGE, ZRANK, ZREM, ZCARD |
| Server | PING, INFO, STATS, FLUSHALL, SAVE, BGSAVE, DBSIZE |
Configuration
Create sbcache.conf:
[server] host = "0.0.0.0" port = 6379 max_clients = 10000
[memory] max_memory_mb = 1024 eviction_policy = "lru"
[persistence] save = ["3600 1", "300 100", "60 10000"] rdb_compression = true
[aof] enabled = false appendfsync = "everysec"
Architecture
sbcache/ ├── cli/ # Command-line interfaces ├── core/ # Core engine and data structures ├── memory/ # Memory management and eviction ├── network/ # TCP server and protocol ├── persistence/ # Snapshot and AOF ├── pubsub/ # Publish/Subscribe ├── queue/ # Queue implementations ├── replication/ # Master-slave replication ├── security/ # Authentication and ACL ├── sdk/ # Client libraries ├── monitor/ # Statistics and monitoring ├── config/ # Configuration management └── utils/ # Shared utilities
Performance
Benchmark results on typical hardware:
- Throughput: 50,000+ ops/sec
- Latency: Less than 100 microseconds (average)
- Memory overhead: About 80 bytes per key-value pair
Run benchmark:
sbcache-benchmark -n 10000 -c 10
Requirements
- Python 3.12 or higher
- No external dependencies (uses only standard library)
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! See CONTRIBUTING.md.
Author
SBCache Team
Acknowledgments
- Inspired by Redis
- Built with Python asyncio
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sbcache-1.0.2.tar.gz.
File metadata
- Download URL: sbcache-1.0.2.tar.gz
- Upload date:
- Size: 39.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e34ea84fa992349f35f1e5a11d4284e0cf1b48f341ff01f176ecad9fa6208b8
|
|
| MD5 |
c99e5712aeff7fdb2fa227b8be8d5629
|
|
| BLAKE2b-256 |
d85163a3194748fc28a59e44729f44f99a9960383b40e4247acb8d3c3f6a67a4
|
File details
Details for the file sbcache-1.0.2-py3-none-any.whl.
File metadata
- Download URL: sbcache-1.0.2-py3-none-any.whl
- Upload date:
- Size: 51.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8260144e354c9dbb61d8e8355148ea33bcea938d45deab93ba1b605cc416ec6
|
|
| MD5 |
a01c4329edd3966f9e0f0e24baac98ef
|
|
| BLAKE2b-256 |
fe44e004e58f19300e35c030b5ce5553dd367f2dc13b9a72472b32db3ab39a60
|