Implementing a cache

skip at pobox.com skip at pobox.com
Sun Jul 12 15:40:45 CEST 2009


    >> My Cache module does #1 and #3.  I'm not sure if you want #2 for
    >> internal cache maintenance or for as part of the API.
    >> 
    >>    http://www.smontanaro.net/python/Cache.py

    pdpi> I'm not sure whether #2 is doable at all, as written. You _need_ a
    pdpi> complete history (at least the full ordering of the items in the
    pdpi> cache) to be able to tell what the least recently used item is.

I should have added that my Cache module does maintain a history.  (Clearly
it needs that to determine the LRU item.)  It is exposed as part of the API
via the ftimes method.

S



More information about the Python-list mailing list