Skip to content
Jonathan Guthrie edited this page Sep 17, 2013 · 1 revision

Standard Commands

The Lasso memcached client also supports all standard Memcached commands. These can be utilized if you'd like to work with Memcached directly.

set

set(key::string,value::any,expires::integer=0)::boolean set(key::string,value::any,expires::date)::boolean

Store the specified value:

memcached->set('mykey','my val)

get

get(key::string)::any get(keys::array,asmap::boolean=false)::map

Retrieve the specified key(s) from the server.

Returns either the value or a map containing the results if multiple keys are specified:

memcached->get('mykey')
memcached->get(array('mykey','anotherkey'))

append

append(key::string,value::any,expires::integer=0)::boolean

Append to value to an existing key.

memcached->append('mykey','append

prepend

prepend(key::string,value::any,expires::integer=0)::boolean

Prepend to value to an existing key.

memcached->prepend('mykey','prepend 

cas (check and set)

cas(key::string,value::any,cas::integer,expires::integer=0)::boolean

Store the specified value only if it hasn't change since last retrieved. Use the cas parameter provided by gets(array,true) to make this call.

memcached->cas('mykey','new value',12345)

delete

delete(key::string)::boolean

The command "delete" allows for explicit deletion of items

memcached->delete('mykey')

incr

incr(key::string,value::integer=1)::integer

Increment the specified key by the value — key must exist. Returns new integer value.

memcached->incr('mykey')

decr

decr(key::string,value::integer=1)::integer

Decrement the specified key by the value — key must exist. Returns new integer value.

memcached->decr('mykey',1)

touch

touch(key::string,expires::integer)::boolean touch(key::string,expires::date)::boolean

Reset the expiration time on a key — key must exist. Supported by Memcached version 1.4.8 and greater. Returns boolean

memcached->touch('mykey',60)

flush

flush::boolean flush(expires::integer)::boolean flush(expires::date)::boolean

Flush the cach of all key or keys due to expire after specific value. Returns boolean.

memcached->flush

version

Returns the version of the first specified server.

versions

Returns a map contain the version of each server.