Commit Graph

15 Commits (ea2f97e9ed8317dc9a62e45d9a807dca7e3700a5)

Author SHA1 Message Date
Kim Alvefur 915ef3a222 util.cache: Pass cache itself to eviction callback 3 years ago
Kim Alvefur 29b6ed4f0a util.cache: Keep eviction candidate if callback resized to make room 3 years ago
Matthew Wild 48521ba153 util.cache: Add __name to metatable 5 years ago
Kim Alvefur f81f466b28 util.cache: Call on-eviction callback when shrinking 8 years ago
Kim Alvefur fbe0a8387a util.cache: Add a method to resize the cache 8 years ago
Kim Alvefur 41d8ce3493 util.cache: Add method for removing all data (does not call eviction callback) 8 years ago
Kim Alvefur 5205d9f5b3 util.cache: Ignore unused argument [luacheck] 9 years ago
Matthew Wild 59957bc13c util.cache: Add support for creating a proxy table to a cache, that looks and acts (mostly) like a normal table. No tests yet. 10 years ago
Kim Alvefur 8fb50705d1 util.cache: Add method for iterating over values 10 years ago
Matthew Wild 6b4c1ca955 util.cache: Change behaviour of on_evict (and tests). Now accepts false instead of a function (never evict), or on_evict can return false to prevent eviction. 10 years ago
Matthew Wild 5f86077aa2 util.cache: Add head() and tail() methods (and tests) 10 years ago
Matthew Wild 7e1480d62e util.cache (and tests): Call on_evict after insertion of the new key, so inside on_evict we can be more certain about the current state of the cache (i.e. full, new item added, old item removed) 10 years ago
Matthew Wild c81eea619a util.cache: Small update to prefix private fields with an underscore, add a :count() method (same as util.queue) and add an optional on_evict callback 10 years ago
Kim Alvefur dd9e60beba util.cache: Make sure cache size is specified as an integer 10 years ago
Matthew Wild 89bc6c6ad7 util.cache: Ordered key->value data structure, with size limit (same as pubsub) 10 years ago