How to implement a LRU Cache with Erlang?
Top starred Github project was fogfish/cache, but Segmented table was not quite fit for my data.
barrel-db/erlang-lru was using a List. after testing, it would be slow if there were too much data.
I guess the problem was here.
move_front(List, Key) ->
[Key | lists:delete(Key, List)].
With Java, a better implementation was using a hashmap and a linkedlist like this
I tried to do a linkedlist, and then realized that Linkedlist was not good idea for Erlang, like this thread.
the question is how to do a LRU cache with Erlang?