package.path=[[D:\work\mod_lua\lib\?.lua;D:\work\mod_lua\lib\?\?.lua;D:\work\lua\lualib\?.lua;D:\work\lua\lualib\?\?.lua]] package.cpath=[[D:\work\lua\bin\?.dll;D:\work\lua\lua\bin\?\?.dll]] require('Memcached') memcache = Memcached.Connect('127.0.0.1', 11211) memcache:set('some_key', 1234) memcache:add('new_key', 'add new value') memcache:add('existing_key', 'existing value') memcache:replace('existing_key', 'replace old value') cached_data = memcache:get('some_key') print (cached_data) memcache:delete('old_key') --[[ Methods: memcache = Memcached.Connect(host[, port]) Connect to memcached server at 'host' on port number 'port'. If port is not provider, port 11211 is used. memcache:set(key, value) Unconditionally sets a key to a given value in the memcache. memcache:add(key, value) Like set, but only stores in memcache if the key doesn't already exist. memcache:replace(key, value) Like set, but only stores in memcache if the key already exists. The opposite of add. value = memcache:get(key) Retrieves a key from the memcache. Returns the value or nil memcache:delete(key) Deletes a key. Returns true on deletion, nil if the key was not found. value = memcache:incr(key[, value]) Sends a command to the server to atomically increment the value for key by value, or by 1 if value is nil. Returns nil if key doesn't exist on server, otherwise it returns the new value after incrementing. Value should be zero or greater. value = memcache:decr(key[, value]) Like incr, but decrements. Unlike incr, underflow is checked and new values are capped at 0. If server value is 1, a decrement of 2 returns 0, not -1. --]]