On 1/4/11 1:29 PM, bearophile wrote:
Andrei:

There is a difference between caching and memoization.

Yep, memoization is a special case of caching:
http://en.wikipedia.org/wiki/Memoization:
"Although related to caching, memoization refers to a specific case of this 
optimization,"


I wouldn't want to burden the memoization implementation with LRU management.

My second proposal was a LRU, but the first simpler one wasn't. Even removing 
one random item when the cache memory is full (like the first inserted, so it's 
not a true LRU and you don't need double links) is better than clearing the 
clearing the whole memory as now.

Bye,
bearophile

Removing a random element behaves surprisingly well and crossed my mind too. If only the built-in hash would allow such a thing...

Andrei

Reply via email to