Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

few fixups #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions memcached.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ local assert, print, setmetatable, type, tonumber, tostring =


---Non-blocking Lua client for memcached.
module("memcached")
-- module("memcached")
local exports = {} -- module is dead CMH


local fmt = string.format
local Memcached = {}
Expand All @@ -49,7 +51,7 @@ local Memcached = {}
-- @param port Defaults to 11211.
-- @param defer_hook An optional function, called to defer, enabling
-- non-blocking operation.
function connect(host, port, defer_hook)
exports.connect = function(host, port, defer_hook)
host, port = host or "localhost", port or 11211

local m = setmetatable({ _host=host, _port=port,
Expand All @@ -71,6 +73,7 @@ end


local function init_con(self)
local err
local sock = self._s
if not sock then
sock, err = Memcached:connect()
Expand Down Expand Up @@ -270,7 +273,7 @@ function Memcached:delete(key, noreply)
local msg = fmt("delete %s%s\r\n",
key, noreply and " noreply" or "")
local ok, err = self:send_recv(msg)
return res and res == "DELETED", res or false, err
return ok and ok == "DELETED", ok or false, err
end


Expand Down Expand Up @@ -331,3 +334,5 @@ end
function Memcached:quit()
return self:send_recv("quit\r\n")
end

return exports