twisted.protocols.memcache
module documentationtwisted.protocols
View Source
Memcache client protocol. Memcached is a caching server, storing data in the form of pairs key/value, and memcache is the protocol to talk with it.
To connect to a server, create a factory for MemCacheProtocol
:
from twisted.internet import reactor, protocol from twisted.protocols.memcache import MemCacheProtocol, DEFAULT_PORT d = protocol.ClientCreator(reactor, MemCacheProtocol ).connectTCP("localhost", DEFAULT_PORT) def doSomething(proto): # Here you call the memcache operations return proto.set("mykey", "a lot of data") d.addCallback(doSomething) reactor.run()
All the operations of the memcache protocol are present, but MemCacheProtocol.set
and MemCacheProtocol.get
are the more important.
See http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt for more information about the protocol.
Class | NoSuchCommand | Exception raised when a non existent command is called. |
Class | ClientError | Error caused by an invalid client call. |
Class | ServerError | Problem happening on the server. |
Class | Command | Wrap a client action into an object, that holds the values used in the protocol. |
Class | MemCacheProtocol | MemCache protocol: connect to a memcached server to store/retrieve values. |