Metadata-Version: 2.4
Name: sbcache
Version: 1.0.0
Summary: SBCache - High-Performance In-Memory Cache Server
Author: SBCache Team
License: MIT
Project-URL: Homepage, https://github.com/satoribyte/sbcache
Project-URL: Repository, https://github.com/satoribyte/sbcache
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# 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
