Skip to main content
Version: 7.2402.x.x RR

GlobalStore

MethodDescriptionSample
package.path = package.path .. ";/opt/nevisproxy/webapp/WEB-INF/lib/lua/public/?.lua" local GlobalStore = require "GlobalStore" GlobalStore:new(servlet)Creates an instance of a global store. A global store provides wide access to name-value pairs stored within the given session store servlet. If you use a remote session store servlet, you can share data over several instances.
GlobalStore:set(name, value, timeout)Sets a name-value pair with a time-out (in seconds). The system will automatically clean up the name-value pair after the specified time-out.Create a shared variable that lives for 10 seconds:store = GlobalStore:new("MySessionStoreServlet")store:set("myVar", "myVal", 10)
GlobalStore:get(name)Gets a name-value pair from the global store. If no entry can be found, nil will be returned.store = GlobalStore:new("MySessionStoreServlet")val = store:get("myVar")

Contrary to the local store, the global store does survive a reinit or even a reboot in case you use a remote session store servlet. If you use a global session store servlet, the global store can be used to share variables across instances. An example of a global session store servlet is the MySqlSessionStoreServlet.