diff options
author | Kim Alvefur <zash@zash.se> | 2016-04-15 13:19:20 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-04-15 13:19:20 +0200 |
commit | 8a13261fc299ed0b3900761915c6e9d102f72118 (patch) | |
tree | 28ca4f99fc7db77ab63972b07a24ec0827765040 | |
parent | c8b2b00c928e5922ab38929626155eb2a2cf8a05 (diff) | |
download | prosody-8a13261fc299ed0b3900761915c6e9d102f72118.tar.gz prosody-8a13261fc299ed0b3900761915c6e9d102f72118.zip |
util.cache: Add method for iterating over values
-rw-r--r-- | util/cache.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/util/cache.lua b/util/cache.lua index 074916cd..54f3e10b 100644 --- a/util/cache.lua +++ b/util/cache.lua @@ -88,6 +88,18 @@ function cache_methods:items() end end +function cache_methods:values() + local m = self._head; + return function () + if not m then + return; + end + local v = m.value; + m = m.next; + return v; + end +end + function cache_methods:count() return self._count; end |