Documentation
¶
Overview ¶
Package lua exposes hex/cache to Lua scripts as the "cache" module.
local cache = require("cache")
local ok, err = cache.set("greeting", "hi") -- no TTL
local ok, err = cache.set("hot", "value", 60) -- 60s TTL
local v, hit, err = cache.get("greeting")
local ok = cache.has("greeting")
cache.delete("greeting")
cache.clear() -- driver may refuse
local n, err = cache.increment("counter", 1)
Values are strings on the Lua side; hex/cache stores raw []byte. Structured values should be JSON-encoded before caching — a gopher-json module is on the follow-up list.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TypeStub string
TypeStub is the Teal .d.tl source describing the `cache` module.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.