temiy / io fork watch download tarball
public
Fork of stevedekorte/io
Description: [project freezed] Io programming language

Addons/Memcache

Memcache

Memcached client addon for Io. Memcached is very fast, multi-threaded cache server.

connect (aSequence host, aSequence or aNumber port = 11211)

Connect to memcached server on host:port.

Examples:

Memcache connect("127.0.0.1", 11211)
Memcache connect("localhost")

addServer (aSequence host, aSequence or aNumber port = 11211)

Add server to Memcache connection pool.

Examples:

Memcache addServer("10.10.10.1") addServer("10.10.10.1", 42144) addServer("10.10.10.2")

get (aSequence key)

Retrieve value of the key from server.

Examples:

Memcache connect("localhost") get("key1")
value := Memcache get("key2")

set (aSequence key, aSequence or aNumber value, aNumber expires = self defaultExpires)

Add or replace key with new value. Sets expires time of key to ‘expires’ seconds from now.

Examples:

Memcache connect("localhost")
Memcache set("key1", "value1") // defaultExpires is one hour
Memcache get("key1")
Memcache set("key2", 25, 30) // 30 seconds from now

delete (aSequence key)

Delete key from server.

Examples:

Memcache connect('localhost") set("key1", "value1")
Memcache delete("key1")
Memcache get("key1") // --> nil

clean

Removes all keys from all memcached servers.

Last edited by temiy, 4 months ago
Versions: