Module: gears.cache
Cache object with data that can be garbage-collected.
Here is an example with a basic cache:
Info:
- Copyright: 2015 Uli Schlachter
-
Originally authored by: Uli Schlachter
(Full contributors list available on our github project)
Constructors
gears.cache (creation_cb) | Create a new cache object. |
Methods
:get (...) | Get an entry from the cache, creating it if it's missing. |
Constructors
- 🔗 gears.cache (creation_cb)
-
Create a new cache object. A cache keeps some data that can be
garbage-collected at any time, but might be useful to keep.
Parameters:
Name Type(s) Description creation_cb Callback that is used for creating missing cache entries. Returns:
-
A new cache object.
Methods
- 🔗 :get (...)
-
Get an entry from the cache, creating it if it's missing.
Parameters:
Name Type(s) Description ... Arguments for the creation callback. These are checked against the cache contents for equality. Returns:
-
The entry from the cache