Upstream # 97c3e6be von Brawlbot
This commit is contained in:
@ -2,7 +2,7 @@ package.path = './.luarocks/share/lua/5.2/?.lua;./.luarocks/share/lua/5.2/?/init
|
||||
require("luarocks.loader")
|
||||
require("./bot/utils")
|
||||
|
||||
VERSION = '20151112'
|
||||
VERSION = '20151205'
|
||||
|
||||
-- This function is called when tg receive a msg
|
||||
function on_msg_receive (msg)
|
||||
|
@ -640,4 +640,17 @@ function get_location(user_id)
|
||||
else
|
||||
return set_location
|
||||
end
|
||||
end
|
||||
|
||||
function cache_data(plugin, query, data, timeout, typ)
|
||||
-- How to: cache_data(pluginname, query_name, data_to_cache, expire_in_seconds)
|
||||
if not timeout then timeout = 86400 end
|
||||
local hash = 'telegram:cache:'..plugin..':'..query
|
||||
print('Caching "'..query..'" from plugin '..plugin..' (expires in '..timeout..' seconds)')
|
||||
if typ == 'key' then
|
||||
redis:set(hash, data)
|
||||
else
|
||||
redis:hmset(hash, data)
|
||||
end
|
||||
redis:expire(hash, timeout)
|
||||
end
|
Reference in New Issue
Block a user