[erlang-questions] beginner: implement a cache/memoization
Maximillian Dornseif
md@REDACTED
Wed Oct 31 08:02:16 CET 2007
I have a function which takes 1-5 sec to compute and will be called about 15
times a minute. Since many of the queries occure repeated I was thinking of
caching the last 1000 results (Each about 200 bytes).
The simpelest solution would be to create a ringbuffer. What would be the
appropriate datastructure? A Queue? This would mean that for every cace
check I would have to call lists:to_list/1.
An alternative would be a "Real" LRU cache. Is there an elegant
datastructure for that? Or do I have to go with an ets table an a cache
expiry process?
Regards
Maximillian
--
View this message in context: http://www.nabble.com/beginner%3A-implement-a-cache-memoization-tf4723208.html#a13503890
Sent from the Erlang Questions mailing list archive at Nabble.com.
More information about the erlang-questions
mailing list