python - How to increase MemCacheProtocol's MAX_KEY_LENGTH? -
i trying alter max_key_length tried next example:
from twisted.internet import reactor, protocol twisted.protocols.memcache import memcacheprotocol, default_port import string twisted.python import log import sys log.startlogging(sys.stdout) def cb(response): log.msg(response) d = protocol.clientcreator(reactor, memcacheprotocol ).connecttcp('localhost', default_port) def dosomething(proto): # here phone call memcache operations homecoming proto.set(string.ascii_letters*5, string.ascii_letters*5) memcacheprotocol.max_key_length = 1000 d.addcallback(dosomething) d.addboth(cb) d.addboth(lambda ignore: reactor.stop()) reactor.run()
i maintain getting failure:
[failure instance: traceback (failure no frames): <class 'twisted.protocols.memcache.clienterror'>: bad command line format!
i guessing not message sent memcache server , result returns failure need in order store keys length greater 250 in memcache?
you modifying late. seek this:
class mymemcacheprotocol(memcacheprotocol): max_key_length = 1000
now utilize class in clientcreator() phone call instead of original.
python twisted
No comments:
Post a Comment