[erlang-questions] How would you implement TTL for ETS based cache?
Thu Mar 14 15:29:33 CET 2013
I have been experimenting with similar approach. The main idea was to keep a two ETS based indexes. The first one it key-value map, second is expire-key map. Second index allows you to handle eviction. You have a process that evict a items when they are expired.
I did a quick proto but never had opportunity to evolve it further.
It would be excellent to get community comments on it.
On 14.3.2013, at 16.15, Max Bourinov <bourinov@REDACTED> wrote:
> Hi Erlangers,
> How would you implement TTL with callback for ETS based cache?
> I want when TTL expires callback is triggered and cached value goes to DB.
> For key I use 32 byte long binary(), value is not bigger than 8 KB.
> Any suggestions?
> p.s. elang:send_after/3 is a most brutal approach, but how would it be when cache is under load?
> Best regards,
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions