Skip to content
WeftKitBeta
Modules/WeftKitMem
RedisMemcached

WeftKitMem

In-Memory Cache

Ultra-fast in-memory cache with lock-free hash maps, configurable eviction policies, optional persistence snapshots, pub/sub, and atomic counters.

~116 ns

p99 point read (single-process)

Lock-free Hash MapsLRU/LFU/ARCPub/SubAtomic CountersSnapshots
Features

Key Features

What makes WeftKitMem stand out.

Lock-Free Data Structures

Concurrent lock-free hash maps for maximum multi-core throughput. Up to 20M+ ops/sec on 8 threads.

Configurable Eviction Policies

LRU (Least Recently Used), LFU (Least Frequently Used), ARC (Adaptive Replacement Cache). Hard memory bounds with no silent OOM.

Pub/Sub Messaging

Channel-based publish/subscribe with pattern matching. Ordered delivery within channels. Backpressure-aware subscriber queues.

Atomic Operations

INCR, DECR, atomic CAS, compare-and-swap, bit operations. Transactional batches with rollback semantics.

Optional Persistence

Snapshot-to-disk for warm restart. Background write to WAL. RDB-compatible snapshot format.

Rich Data Types

Strings, lists, sets, sorted sets, hashes, bit arrays, streams, and HyperLogLog. Redis-compatible API.

Performance

Performance Targets

Real numbers from Criterion benchmarks on reference hardware.

Point read p99 (single process)< 1 μs
Throughput (1 thread)> 5M ops/sec
Throughput (8 threads)> 20M ops/sec
Compatibility

Wire Protocol

WeftKitMem supports the Redis RESP3 protocol. Your existing tools just work.

redis-cliredis-pylettuceioredis
Code Example

Get Started in Seconds

Add WeftKitMem to your Rust project and start querying.

inmemory.rs
rust
use weftkitmem::prelude::*;

// Open or create a database
let db = Database::open("my_app.db")?;

// Use the module API
let result = db.query("SELECT * FROM users WHERE active = true")?;

for row in result.rows() {
    println!("{:?}", row);
}
Use Cases

Where to Use It

1

Application-level caching

2

Real-time leaderboards and counters

3

Session state management