Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sbcache-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sbcache-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file sbcache-1.0.0.tar.gz.

File metadata

  • Download URL: sbcache-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for sbcache-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6e899e31f45cebe71943cf016a0674eb0f540919251056591d84304b0d926e6d
MD5 de8ace4ccf43a0927d8af241780f40d6
BLAKE2b-256 b325cdb78ff4f1cf3aecfb029c895904f21cd45458cabe80038025716cd34102

See more details on using hashes here.

File details

Details for the file sbcache-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sbcache-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for sbcache-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1a1e41481496f2b8221a1d0e7f197b1e6eda4b07274267774299932ee2b97aa
MD5 c2e6fed34f76ca035c2d3b07dfcac6da
BLAKE2b-256 9aaac68d83e51d3bd99542c3216b9dc64d3b6c96f5c09331a52d7da3292fa8a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page