projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c1d5cc6
)
util.cache: Add method for iterating over values
author
Kim Alvefur
<zash@zash.se>
Fri, 15 Apr 2016 11:19:20 +0000
(13:19 +0200)
committer
Kim Alvefur
<zash@zash.se>
Fri, 15 Apr 2016 11:19:20 +0000
(13:19 +0200)
util/cache.lua
patch
|
blob
|
history
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