mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update cache.lua
Make the cache.lua more robust in case of missing key or value.
This commit is contained in:
@@ -80,17 +80,32 @@ end
|
||||
|
||||
-- convert cache key to memcache key
|
||||
local function key2key(key)
|
||||
return (string.gsub(key, "\\", "\\\\"))
|
||||
if (key) then
|
||||
key = string.gsub(key, "\\", "\\\\");
|
||||
else
|
||||
key = '';
|
||||
end
|
||||
return key;
|
||||
end
|
||||
|
||||
-- encode value to be able store it in memcache
|
||||
local function memcache_encode(value)
|
||||
return (string.gsub(value, "'", "'"):gsub("\\", "\\\\"))
|
||||
if (value) then
|
||||
value = string.gsub(value, "'", "'"):gsub("\\", "\\\\");
|
||||
else
|
||||
value = '';
|
||||
end
|
||||
return value;
|
||||
end
|
||||
|
||||
-- decode value retrived from memcache
|
||||
local function memcache_decode(value)
|
||||
return (string.gsub(value, "'", "'"))
|
||||
if (value) then
|
||||
value = string.gsub(value, "'", "'");
|
||||
else
|
||||
value = '';
|
||||
end
|
||||
return value;
|
||||
end
|
||||
|
||||
function Cache.support()
|
||||
|
||||
Reference in New Issue
Block a user