README
¶
storage ![GoDoc](https://godoc.org/github.com/vadv/gopher-lua-libs/storage?status.svg)
Usage
local storage = require("storage")
-- storage.open
local s, err = storage.open("./test/db.json")
if err then error(err) end
-- storage:set(): key, value, ttl (default = 60s)
local err = s:set("key", {"one", "two", 1}, 10)
if err then error(err) end
-- storage:get()
local value, found, err = s:get("key")
if err then error(err) end
if not found then error("must be found") end
-- value == {"one", "two", 1}
-- storage:set(): override with set max ttl
local err = s:set("key", "override", nil)
local value, found, err = s:get("key")
if not(value == "override") then error("must be found") end
-- storage:keys()
local list = s:keys()
-- list == {"key"}
-- storage:dump()
local dump, err = s:dump()
if err then error(err) end
-- list == {"key" = "override"}
Documentation
¶
Overview ¶
Package storage implements persist storage with ttl for to save and share data between differents lua.LState.
Example (Package) ¶
storage.open(), storage_ud:get(), storage_ud:set()
Output: { "one", "two", 1 } true {key = { "one", "two", 1 }}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.