chickadee » lru-cache » make-lru-cache

make-lru-cache capacity equal? #!optional deleterprocedure

Create an LRU cache capable of holding capacity items. equal? is the item equality procedure and is passed directly to the hash table, as in (make-hash-table equal?). deleter is an optional procedure of two arguments (key value) which will be invoked whenever an item is deleted, flushed or simply falls off the cache.

If capacity is zero, the cache is disabled. Attempts to read items will return #f, and writing them will silently fail.