whitfin / cachex

A powerful caching library for Elixir with support for transactions, fallbacks and expirations
https://hexdocs.pm/cachex/
MIT License
1.6k stars 103 forks source link

Add an experimental LRU caching policy #362

Closed whitfin closed 1 month ago

whitfin commented 1 month ago

Fixes #305.

This PR introduces a very minimal LRU policy implementation, by adding an additional hook to the LRW implementation which updates the modification time when each entry is accessed. This isn't ideal, but it's the easiest implementation with fairly low overhead.

I'm not sure if this qualifies as "complete", but I want to get something into 4.x we can iterate on and the more eyes the better.