Commit d5272b4b authored by Marek Vavruša's avatar Marek Vavruša

daemon/bindings: metatable wasn’t called on cache.{storage|size}

the bindings wrote the keys on completion, so they existed
and __newindex was never called - now current {storage|size}
are saved as cache.current_{storage|size}
parent 587450c7
......@@ -382,10 +382,10 @@ static int cache_open(lua_State *L)
/* Store current configuration */
lua_getglobal(L, "cache");
lua_pushstring(L, "size");
lua_pushstring(L, "current_size");
lua_pushnumber(L, cache_size);
lua_rawset(L, -3);
lua_pushstring(L, "storage");
lua_pushstring(L, "current_storage");
lua_pushstring(L, uri);
lua_rawset(L, -3);
......@@ -52,8 +52,8 @@ setmetatable(modules, {
-- `cache.{size|storage} = value`
setmetatable(cache, {
__newindex = function (t,k,v)
if k == 'size' then, rawget(t, 'storage'))
elseif k == 'storage' then, 'size'), v)
if k == 'size' then, rawget(t, 'current_storage'))
elseif k == 'storage' then, 'current_size'), v)
else rawset(t, k, v) end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment