SkillAgentSearch skills...

Levelcache

LevelCache is an ephemeral embedded cache with TTL support built on top of LevelDB.

Install / Use

/learn @arpitbbhayani/Levelcache
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

LevelCache

License

LevelCache is a high-performance, ephemeral, embedded key-value caching library written in C. It is built on top of Google's LevelDB and provides a simple, clean API for caching with Time-to-Live (TTL) support.

Features

  • Time-to-Live (TTL): Set an expiration time for each key, after which it is automatically considered invalid and deleted upon access.
  • Memory Management: Control the maximum memory usage of the LevelDB cache to manage your application's footprint.
  • Simple C API: A straightforward and easy-to-use function set for open, close, put, get, and delete operations.
  • High Performance: Optimized for fast read and write operations. See the Performance section for details.
  • Well-Tested: Includes a comprehensive test suite using the Google Test framework.

Getting Started

Getting started with levelcache is simple and a step by step guide is documented in examples directory.

Makefile Targets

  • all: Builds the liblevelcache.a static library.
  • test: Builds and runs the Google Test suite.
  • benchmark: Builds and runs the performance benchmark suite.
  • clean: Removes all build artifacts.

Performance

The following benchmarks were run on a 16-core machine with a 100MB database cache. The results are the mean of 3 repetitions.

To run the benchmarks on your own machine, use make benchmark.

| Operation | Throughput (ops/sec) | p50 Latency | p90 Latency | p95 Latency | p99 Latency | |-----------|------------------------|-------------|-------------|-------------|-------------| | Write | ~224,000 | ~3.6 µs | ~4.6 µs | ~5.0 µs | ~6.4 µs | | Read | ~2,016,000 | ~0.3 µs | ~1.1 µs | ~2.0 µs | ~2.9 µs |

Contributing

Contributions are welcome! Feel free to open an issue to report a bug or suggest a feature, or submit a pull request with your improvements.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

View on GitHub
GitHub Stars136
CategoryData
Updated11h ago
Forks9

Languages

C

Security Score

100/100

Audited on Mar 27, 2026

No findings