Moka is an in-memory caching library designed for applications requiring concurrent access to frequently used data. Inspired by the Caffeine caching library, it provides thread-safe cache implementations that balance fast retrieval with policies for controlling memory consumption and deciding which entries should be retained.
The library offers separate synchronous and asynchronous cache interfaces. The synchronous implementation can be shared between operating system threads, while the asynchronous interface integrates with futures-aware application runtimes. Moka combines frequency-based admission with recency-based eviction, allowing it to retain valuable entries when a cache reaches its configured capacity. It also provides mechanisms for loading missing values atomically, avoiding redundant calculations when multiple requests need the same entry.
This is free and open source software.
Key Features
- Thread-safe synchronous cache for concurrent application workloads.
- Asynchronous cache interface compatible with futures-aware runtimes.
- Cache capacity limits based on entry count or total weighted size.
- TinyLFU-inspired cache admission and eviction policies.
- Time-to-live expiration for cached entries.
- Time-to-idle expiration based on the last access.
- Custom expiration policies for individual cache entries.
- Atomic cache population to avoid duplicate value computation.
- Eviction listeners for receiving notifications when entries are removed.
- Concurrent iteration over cached entries.
- Explicit invalidation of individual entries.
- Support for synchronous and asynchronous cache operations.
Website: github.com/moka-rs/moka
Support:
Developer: Tatsuya Sato and contributors
License: Apache License 2.0
Moka is written in Rust. Learn Rust with our recommended free books and free tutorials.
Related Software
| Caching Systems | |
|---|---|
| Memcached | High-performance distributed memory object caching system |
| Redis | Persistent key-value database with network interface |
| Hazelcast | Distributed in-memory data store and computation platform |
| Apache Ignite | Distributed database, caching and processing platform |
| Ehcache | Standards based pure Java in-process cache |
| Java Caching System | Distributed caching system written in Java |
| Couchbase | Distributed key-value database management system |
| Apache Geode | Distributed, in-memory data management platform |
| yrmcds | LRU cache library and key-value server |
| Cachelot | Memory object caching system with master/slave replication |
| Infinispan | Distributed, in-memory database and data grid |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.