projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
util.cache: Add method for iterating over values
[prosody.git]
/
util
/
cache.lua
diff --git
a/util/cache.lua
b/util/cache.lua
index 074916cd6a1c2f6ad41ba392204e560ad7798d03..54f3e10b175055a85696dcbf5fc5040ad2d00028 100644
(file)
--- 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