Attempt to free space in the cache starting with the last accessed element
Attempt to free space in the cache starting with the last accessed element
returns true iff v can be inserted into the cache without violating the size boundary
returns true iff v can be inserted into the cache without violating the size boundary
Lookup the value for key k If the value is in the cache, return it.
Lookup the value for key k If the value is in the cache, return it. Otherwise, insert the value v and return it
Note: This method does not guarantee that v will be in the cache when it returns
the cached value keyed to k or the computed value of v
Insert the value v (keyed by k) into the cache
Insert the value v (keyed by k) into the cache
true if the value was inserted into the cache
Lookup the value for key k
Lookup the value for key k
Some(v) if the value was cached, None otherwise
Maximum size of the cache
Maximum size of the cache
Remove k from the cache
Remove k from the cache
Called when attempt to make space in the cache.
Called when attempt to make space in the cache. This function should return the index of the item to remove next
Return the size of a a given cache item If items are objects (for example) this might just be: (x) => 1 If items are arrays of ints and the maxSize is in bytes this function might be: (x) => x.length * 4
Return the size of a a given cache item If items are objects (for example) this might just be: (x) => 1 If items are arrays of ints and the maxSize is in bytes this function might be: (x) => x.length * 4