Oracle 5.0 Reference Manual page 1391

Table of Contents

Advertisement

Once installed, the
memcache
When you store Python data structures as
into string values) using the Python
To create a new
memcache
class. For example, if the
memcache.Client
default port:
import memcache
memc = memcache.Client(['127.0.0.1:11211'])
The first argument is an array of strings containing the server and port number for each
instance to use. To enable debugging, set the optional
By default, the hashing mechanism used to divide the items among multiple servers is crc32. To
change the function used, set the value of
to use. For example:
from zlib import adler32
memcache.serverHashFunction = adler32
Once you have defined the servers to use within the
the same functionality as in the generic interface specification. The following table provides a summary
of the supported functions:
Python
Function
memcache
get()
get_multi(keys)
set()
set_multi(dict [, expiry [,
key_prefix]])
add()
replace()
prepend(key, value [, expiry])
append(key, value [, expiry[)
delete()
delete_multi(keys [, expiry [,
key_prefix]] )
incr()
decr()
Note
Within the Python
optional
to all key lookups. For example, if you call:
memc.get_multi(['a','b'], key_prefix='users:')
The function retrieves the keys
Here is an example showing the storage and retrieval of information to a
the raw data from MySQL:
Developing a
memcached
module provides a class-based interface to your
memcached
or
cPickle
pickle
interface, import the
memcache
memcached
memcache.serverHashFunction
module, all the *_multi()functions support an
memcache
parameter. If supplied, then the string is used as a prefix
key_prefix
1371
Application
items, they are automatically serialized (turned
modules.
module and create a new instance of the
daemon is running on localhost using the
parameter to 1.
debug
instance, the core functions provide
memcache
Equivalent Generic Function
Generic get().
Gets multiple values from the supplied array of
keys. Returns a hash reference of key/value
pairs.
Generic set().
Sets multiple key/value pairs from the supplied
dict.
Generic add().
Generic replace().
Prepends the supplied
existing key.
Appends the supplied
existing key.
Generic delete().
Deletes all the keys from the hash matching each
string in the array keys.
Generic incr().
Generic decr().
and
users:a
users:b
memcache
servers.
memcached
memcached
to the alternate function
to the value of the
value
to the value of the
value
from the servers.
instance, loading

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents