Software /
code /
prosody
Diff
util/cache.lua @ 7354:8ca7f1c2c660
util.cache: Add method for iterating over values
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 15 Apr 2016 13:19:20 +0200 |
parent | 7290:70ab13e81cf5 |
child | 7435:8603b16e85c7 |
line wrap: on
line diff
--- a/util/cache.lua Wed Apr 13 20:00:41 2016 +0200 +++ b/util/cache.lua Fri Apr 15 13:19:20 2016 +0200 @@ -88,6 +88,18 @@ 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