this post was submitted on 07 Aug 2025
53 points (98.2% liked)

Rust

7518 readers
103 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
 

Hi everyone, I recently created an in-memory cache in Rust called PaperCache. It's the first in-memory cache that's able to switch between any eviction policy at runtime, allowing it to reduce its miss ratio by adapting to changing workloads. Currently, it supports the following eviction policies:

  • LFU
  • FIFO
  • CLOCK
  • SIEVE
  • LRU
  • MRU
  • 2Q
  • ARC
  • S3-FIFO

It typically has lower tail latencies than Redis (though with the trade-off of higher memory overhead as it needs to maintain extra metadata to be able to switch between policies at runtime).

Feel free to check out the website (https://papercache.io/) which has documentation, a high-level article I wrote on Kudos (https://link.growkudos.com/1f039cqaqrk), or the paper from HotStorage'25 (https://dl.acm.org/doi/abs/10.1145/3736548.3737836)

Here's a direct link to the cache internals: https://github.com/PaperCache/paper-cache

In case you want to test it out, you can find installation instructions here: https://papercache.io/guide/getting-started/installation

There are clients for most of the popular programming languages (https://papercache.io/guide/usage/clients), though some may be a little unpolished (I mainly use the Rust client for my own work, so that one is kept up-to-date).

If you have any feedback, please let me know!

top 5 comments
sorted by: hot top controversial new old
[โ€“] unlawfulbooger@lemmy.blahaj.zone 21 points 3 months ago* (last edited 3 months ago) (1 children)

AGPL ๐Ÿ˜Ž

Edit: this looks pretty slick, Iโ€™ll keep it in mind next time I need a cache

[โ€“] papercache@programming.dev 10 points 3 months ago

Thanks, would appreciate any feedback if you end up using it!

[โ€“] Lyra_Lycan@lemmy.blahaj.zone 12 points 3 months ago* (last edited 3 months ago)

When the market doesn't have exactly what you need, the most powerful thing you can do is build your own version.

[โ€“] Jayjader@jlai.lu 3 points 3 months ago (1 children)

Very intriguing! Unfortunately none of my personal projects have yet to hit a scale where this sort of cache is needed, so I won't be trying it out myself anytime soon.

[โ€“] papercache@programming.dev 1 points 3 months ago

No worries, thanks!