Commit graph

13 commits

Author SHA1 Message Date
Matthew Wild
48521ba153 util.cache: Add __name to metatable 2020-10-30 14:05:07 +00:00
Kim Alvefur
f81f466b28 util.cache: Call on-eviction callback when shrinking 2017-11-18 21:35:40 +01:00
Kim Alvefur
fbe0a8387a util.cache: Add a method to resize the cache 2017-11-18 21:35:31 +01:00
Kim Alvefur
41d8ce3493 util.cache: Add method for removing all data (does not call eviction callback) 2017-11-07 00:38:47 +01:00
Kim Alvefur
5205d9f5b3 util.cache: Ignore unused argument [luacheck] 2016-10-18 15:19:01 +02:00
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. 2016-05-22 18:18:23 +01:00
Kim Alvefur
8fb50705d1 util.cache: Add method for iterating over values 2016-04-15 13:19:20 +02:00
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. 2016-03-17 19:08:42 +00:00
Matthew Wild
5f86077aa2 util.cache: Add head() and tail() methods (and tests) 2016-03-17 19:07:40 +00:00
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) 2015-12-22 20:10:07 +00:00
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 2015-11-26 00:07:48 +00:00
Kim Alvefur
dd9e60beba util.cache: Make sure cache size is specified as an integer 2015-11-25 20:49:41 +01:00
Matthew Wild
89bc6c6ad7 util.cache: Ordered key->value data structure, with size limit (same as pubsub) 2015-11-24 10:44:41 +00:00