;ò XÂFc@sdZdkZdkZdkZdkZy dkZWnej odkZnXydkl Z l Z e Z Wn"ej oe Z d„Z nXydklZWn ej odklZnXdklZeZdZdZdZd Zd Zd d Zd efd „ƒYZydklZWn)ej odefd„ƒYZnXdefd„ƒYZdfd„ƒYZdd„Z d„Z!e"djogdGHe!ƒdGHHdgZ#ee#ddƒZ$d„Z%d„Z&d fd!„ƒYZ'e&d"d#ƒe&d$d%ƒe&d&e(dd'>ƒƒo&d(Ge$i)d&ƒo d)GHqQd*GHnd+Ge$i*d"d$gƒGHd,Ge%e$i+d-ƒƒGHe'ƒZ,e&d.e,ƒd/Ge$i-d$dƒZ.e.d0jo d)GHnd*GHd1Ge$i/d$dƒZ.e.d%jo d)GHnd*GHd2Gye$i0d3dƒZ.Wnei1j oZ2d)GHnXd*GHd4Gye$i0d5dƒZ.Wnei1j oZ2d)GHnXd*GHd6Gye$i0d7ed8dƒZ.Wnei3j oZ2d)GHnXd*GHd9Gye$i0d:dƒZ.Wnei4j o Z2d)GnXd*Gy#e$i0d;ei5d<ƒdƒZ.Wn d*GnXd)GdkZei6d=ƒZ7y#e$i0e7ei5d<ƒdƒZ.Wnei3j o d)GHnXd*GHd>Ge$i0d?d7eƒZ.e$i+d?ƒe8jod)Gnd*Ge$i0d?d7ed@ƒZ.e$i+d?ƒe8jo d)GHq d*GHndS(AsÍ client module for memcached (memory cache daemon) Overview ======== See U{the MemCached homepage} for more about memcached. Usage summary ============= This should give you a feel for how this module operates:: import memcache mc = memcache.Client(['127.0.0.1:11211'], debug=0) mc.set("some_key", "Some value") value = mc.get("some_key") mc.set("another_key", 3) mc.delete("another_key") mc.set("key", "1") # note that the key used for incr/decr must be a string. mc.incr("key") mc.decr("key") The standard way to use memcache with a database is like this:: key = derive_key(obj) obj = mc.get(key) if not obj: obj = backend_api.get(...) mc.set(obj) # we now have obj, and future passes through this code # will use the object from the cache. Detailed Documentation ====================== More detailed documentation is available in the L{Client} class. N(scompresss decompresscCstdƒ‚dS(NsFreceived compressed data but I don't support compession (import error)(s_Error(sval((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys decompress=s(sStringIO(scrc32sEvan Martin s1.39s$Copyright (C) 2003 Danga InteractivesPythoniúis_ErrorcBstZRS(N(s__name__s __module__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys_ErrorSs(slocalslocalcBstZRS(N(s__name__s __module__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pyslocal[ssClientcBsÃtZdZdd>Zdd>Zdd>Zdd>ZdZdefd„ƒYZ de fd „ƒYZ d e fd „ƒYZ d efd „ƒYZ dde ie id„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zddd„Zdd„Zdd„Zdd„Zd„Zddd„Zddd„Z ddd „Z!d!„Z"dddd"„Z#d#„Z$dd$„Z%d%„Z&dd&„Z'e(d'„Z)d(„Z*RS()s¤ Object representing a pool of memcache servers. See L{memcache} for an overview. In all cases where a key is used, the key can be either: 1. A simple hashable type (string, integer, etc.). 2. A tuple of C{(hashvalue, key)}. This is useful if you want to avoid making this module calculate a hash value. You may prefer, for example, to keep all of a given user's objects on the same memcache server, so you could use the user's unique id as the hash value. @group Setup: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog @group Insertion: set, add, replace, set_multi @group Retrieval: get, get_multi @group Integers: incr, decr @group Removal: delete, delete_multi @sort: __init__, set_servers, forget_dead_hosts, disconnect_all, debuglog, set, set_multi, add, replace, get, get_multi, incr, decr, delete, delete_multi iiiii sMemcachedKeyErrorcBstZRS(N(s__name__s __module__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysMemcachedKeyError|ssMemcachedKeyLengthErrorcBstZRS(N(s__name__s __module__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysMemcachedKeyLengthError~ssMemcachedKeyCharacterErrorcBstZRS(N(s__name__s __module__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysMemcachedKeyCharacterError€ssMemcachedStringEncodingErrorcBstZRS(N(s__name__s __module__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysMemcachedStringEncodingError‚scCsKti|ƒ|i|ƒ||_h|_||_||_||_ dS(sï Create a new Client object with the given list of servers. @param servers: C{servers} is passed to L{set_servers}. @param debug: whether to display error messages when a server can't be contacted. N( slocals__init__sselfs set_serverssserverssdebugsstatsspickleProtocolspicklers unpickler(sselfsserverssdebugspickleProtocolspicklers unpickler((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys__init__…s      cCsDgi}|D]}|t||iƒƒq~|_|iƒdS(sd Set the pool of servers used by this client. @param servers: an array of servers. Servers can be passed in two forms: 1. Strings of the form C{"host:port"}, which implies a default weight of 1. 2. Tuples of the form C{("host:port", weight)}, where C{weight} is an integer weight value. N(sappends_[1]sserverssss_Hostsselfsdebuglogs _init_buckets(sselfsserverss_[1]ss((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys set_servers˜s 6cCsÞg}xÍ|iD]Â}|iƒ oqnd|i|i|if}|i dƒh}|i ||fƒ|i }xYnoQ|ƒ}| p|iƒdjoPn|iddƒ}|d||dtij o-} d} |i| dƒ|i |ƒq>Xq>Wx|D] }||=qWg}xj|iƒD]\\}}y"x|D]} |idƒqNWWq8tij o} |i| ƒd} q8Xq8W| SdS( sØ Delete multiple keys in the memcache doing just one query. >>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'}) >>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'} 1 >>> mc.delete_multi(['key1', 'key2']) 1 >>> mc.get_multi(['key1', 'key2']) == {} 1 This method is recommended over iterated regular L{delete}s as it reduces total latency, since your app doesn't have to wait for each round-trip of L{delete} before sending the next one. @param keys: An iterable of keys to clear @param seconds: number of seconds any subsequent set / update commands should fail. Defaults to 0 for no delay. @param key_prefix: Optional string to prepend to each key when sending to memcache. See docs for L{get_multi} and L{set_multi}. @return: 1 if no failure in communication with any memcacheds. @rtype: int s delete_multiisdelete %s %d s delete %s sisDELETEDN(sselfs_statlogs_map_and_prefix_keysskeyss key_prefixs server_keyssprefixed_to_orig_keys dead_serverssrcsiterkeyssserversbigcmdsappendswritestimesNoneskeyssecondss send_cmdssjoinssocketserrorsmsgs mark_deads notstoreds iteritemssexpect(sselfskeysssecondss key_prefixs server_keyss notstoredsbigcmdsservers dead_serversswriteskeysrcsmsgsprefixed_to_orig_key((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys delete_multiísH         cCs½t|ƒ|i|ƒ\}}| odSn|idƒ|tjod||f}n d|}y|i |ƒ|i dƒWn-t i j o}|i|dƒdSnXdSdS(sÛDeletes a key from the memcache. @return: Nonzero on success. @param seconds: number of seconds any subsequent set / update commands should fail. Defaults to 0 for no delay. @rtype: int isdeletes delete %s %ds delete %ssDELETEDiN(s check_keyskeysselfs _get_serversservers_statlogstimesNonescmdssend_cmdsexpectssocketserrorsmsgs mark_dead(sselfskeystimescmdsserversmsg((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysdelete.s       cCs|id||ƒSdS(s4 Sends a command to the server to atomically increment the value for C{key} by C{delta}, or by 1 if C{delta} is unspecified. Returns None if C{key} doesn't exist on server, otherwise it returns the new value after incrementing. Note that the value for C{key} must already exist in the memcache, and it must be the string representation of an integer. >>> mc.set("counter", "20") # returns 1, indicating success 1 >>> mc.incr("counter") 21 >>> mc.incr("counter") 22 Overflow on server is not checked. Be aware of values approaching 2**32. See L{decr}. @param delta: Integer amount to increment by (should be zero or greater). @return: New value after incrementing. @rtype: int sincrN(sselfs _incrdecrskeysdelta(sselfskeysdelta((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysincrGscCs|id||ƒSdS(sV Like L{incr}, but decrements. Unlike L{incr}, underflow is checked and new values are capped at 0. If server value is 1, a decrement of 2 returns 0, not -1. @param delta: Integer amount to decrement by (should be zero or greater). @return: New value after decrementing. @rtype: int sdecrN(sselfs _incrdecrskeysdelta(sselfskeysdelta((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysdecr`s cCsªt|ƒ|i|ƒ\}}| odSn|i|ƒd|||f}y'|i|ƒ|i ƒ}t |ƒSWn-t i j o}|i|dƒtSnXdS(Nis%s %s %di(s check_keyskeysselfs _get_serversservers_statlogscmdsdeltassend_cmdsreadlineslinesintssocketserrorsmsgs mark_deadsNone(sselfscmdskeysdeltasserversmsgsline((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys _incrdecrls    cCs|id||||ƒSdS(s· Add new key with value. Like L{set}, but only stores in memcache if the key doesn't already exist. @return: Nonzero on success. @rtype: int saddN(sselfs_setskeysvalstimesmin_compress_len(sselfskeysvalstimesmin_compress_len((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysadd{scCs|id||||ƒSdS(sÐReplace existing key with value. Like L{set}, but only stores in memcache if the key already exists. The opposite of L{add}. @return: Nonzero on success. @rtype: int sreplaceN(sselfs_setskeysvalstimesmin_compress_len(sselfskeysvalstimesmin_compress_len((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysreplace‡scCs|id||||ƒSdS(s&Unconditionally sets a key to a given value in the memcache. The C{key} can optionally be an tuple, with the first element being the hash value, if you want to avoid making this module calculate a hash value. You may prefer, for example, to keep all of a given user's objects on the same memcache server, so you could use the user's unique id as the hash value. @return: Nonzero on success. @rtype: int @param time: Tells memcached the time which this value should expire, either as a delta number of seconds, or an absolute unix time-since-the-epoch value. See the memcached protocol docs section "Storage Commands" for more info on . We default to 0 == cache forever. @param min_compress_len: The threshold length to kick in auto-compression of the value using the zlib.compress() routine. If the value being cached is a string, then the length of the string is measured, else if the value is an object, then the length of the pickle result is measured. If the resulting attempt at compression yeilds a larger string than the input, then it is discarded. For backwards compatability, this parameter defaults to 0, indicating don't ever try to compress. ssetN(sselfs_setskeysvalstimesmin_compress_len(sselfskeysvalstimesmin_compress_len((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysset‘sc Cst|ƒ}|ot|ƒnh}h}xÙ|D]Ñ} t| ƒt i jo7t | dƒ}|i| d||fƒ\}}n&t | ƒ}|i||ƒ\}}t|d|ƒ| oq4n|i|ƒ og|| list of keys to stuff onto that server, as well as the mapping of prefixed key -> original key. iis key_extra_lenN(slens key_prefixs key_extra_lens check_keys server_keyssprefixed_to_orig_keys key_iterablesorig_keystypestypess TupleTypesstrs str_orig_keysselfs _get_serversserverskeyshas_keysappend( sselfs key_iterables key_prefixs server_keysskeys str_orig_keysservers key_extra_lensprefixed_to_orig_keysorig_key((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys_map_and_prefix_keys«s* ' c Cs¹|idƒ|i|iƒ|ƒ\}}g} xÎ|iƒD]À} g}|i } yrxU|| D]I} |i||| |ƒ}| d| |d||d|dfƒqaW| idi|ƒƒWq>tij o'} | i| dƒ| i | ƒq>Xq>Wx| D] } || =q Wg}xŽ|iƒD]€\} }yFx?|D]7} | iƒ}|djoqCqC|i || ƒqCWWq-ttifj o} | i| ƒq-Xq-W|SdS( sà Sets multiple keys in the memcache doing just one query. >>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'}) >>> mc.get_multi(['key1', 'key2']) == {'key1' : 'val1', 'key2' : 'val2'} 1 This method is recommended over regular L{set} as it lowers the number of total packets flying around your network, reducing total latency, since your app doesn't have to wait for each round-trip of L{set} before sending the next one. @param mapping: A dict of key/value pairs to set. @param time: Tells memcached the time which this value should expire, either as a delta number of seconds, or an absolute unix time-since-the-epoch value. See the memcached protocol docs section "Storage Commands" for more info on . We default to 0 == cache forever. @param key_prefix: Optional string to prepend to each key when sending to memcache. Allows you to efficiently stuff these keys into a pseudo-namespace in memcache: >>> notset_keys = mc.set_multi({'key1' : 'val1', 'key2' : 'val2'}, key_prefix='subspace_') >>> len(notset_keys) == 0 True >>> mc.get_multi(['subspace_key1', 'subspace_key2']) == {'subspace_key1' : 'val1', 'subspace_key2' : 'val2'} True Causes key 'subspace_key1' and 'subspace_key2' to be set. Useful in conjunction with a higher-level layer which applies namespaces to data in memcache. In this case, the return result would be the list of notset original keys, prefix not applied. @param min_compress_len: The threshold length to kick in auto-compression of the value using the zlib.compress() routine. If the value being cached is a string, then the length of the string is measured, else if the value is an object, then the length of the pickle result is measured. If the resulting attempt at compression yeilds a larger string than the input, then it is discarded. For backwards compatability, this parameter defaults to 0, indicating don't ever try to compress. @return: List of keys which failed to be stored [ memcache out of memory, etc. ]. @rtype: list s set_multisset %s %d %d %d %s iiissSTOREDN(sselfs_statlogs_map_and_prefix_keyssmappingsiterkeyss key_prefixs server_keyssprefixed_to_orig_keys dead_serverssserversbigcmdsappendswriteskeys_val_to_store_infosmin_compress_lens store_infostimes send_cmdssjoinssocketserrorsmsgs mark_deads notstoreds iteritemsskeyssreadlineslines_Error(sselfsmappingstimes key_prefixsmin_compress_lens server_keyss notstoredskeyssbigcmdsservers dead_serversswriteskeysmsgslinesprefixed_to_orig_keys store_info((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys set_multiÒsB'    -    cCsSd}t|tƒon§t|tƒo!|tiO}d|}d}nvt|tƒo!|ti O}d|}d}nE|ti O}t ƒ}|i||iƒ}|i|ƒ|iƒ}t|ƒtjodSnt|ƒ}|oto ||jo:t|ƒ}t|ƒ|jo|tiO}|}q<n|t|ƒ|fSdS(s— Transform val to a storable representation, returning a tuple of the flags, the length of the new value, and the new value itself. is%dN(sflagss isinstancesvalsstrsintsClients _FLAG_INTEGERsmin_compress_lenslongs _FLAG_LONGs _FLAG_PICKLEsStringIOsfilesselfspicklerspickleProtocolsdumpsgetvalueslensSERVER_MAX_VALUE_LENGTHslvs_supports_compressscompressscomp_vals_FLAG_COMPRESSED(sselfsvalsmin_compress_lenspicklersfileslvsflagsscomp_val((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys_val_to_store_info!s4             c CsÞt|ƒ|i|ƒ\}}| odSn|i|ƒ|i||ƒ} | odSnd||| d|| d| df}y$|i |ƒ|idƒdjSWn)tij o}|i|dƒnXdSdS(Nis%s %s %d %d %d %siisSTORED(s check_keyskeysselfs _get_serversservers_statlogscmds_val_to_store_infosvalsmin_compress_lens store_infostimesfullcmdssend_cmdsexpectssocketserrorsmsgs mark_dead( sselfscmdskeysvalstimesmin_compress_lensfullcmdsserversmsgs store_info((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys_setGs  ( cCsùt|ƒ|i|ƒ\}}| otSn|idƒy_|id|ƒ|i|ƒ\}}}| otSn|i |||ƒ}|idƒWnSttifj o>}t|ƒtijo|d}n|i|ƒtSnX|SdS(sPRetrieves a key from the memcache. @return: The value or None. sgetsget %ssENDiN(s check_keyskeysselfs _get_serversserversNones_statlogssend_cmds _expectvaluesrkeysflagssrlens _recv_valuesvaluesexpects_Errorssocketserrorsmsgstypestypess TupleTypes mark_dead(sselfskeysrlensrkeysvaluesserversflagssmsg((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysgetZs&    cCs|idƒ|i||ƒ\}} g}xo|iƒD]a}y"|i ddi ||ƒƒWq8t i j o'} |i| dƒ|i|ƒq8Xq8Wx|D] }||=q¤Wh} xÉ|iƒD]»}y‡|iƒ} xt| o | djo_|i|| ƒ\}} }|tj o'|i|| |ƒ}|| | |>> success = mc.set("foo", "bar") >>> success = mc.set("baz", 42) >>> mc.get_multi(["foo", "baz", "foobar"]) == {"foo": "bar", "baz": 42} 1 >>> mc.set_multi({'k1' : 1, 'k2' : 2}, key_prefix='pfx_') == [] 1 This looks up keys 'pfx_k1', 'pfx_k2', ... . Returned dict will just have unprefixed keys 'k1', 'k2'. >>> mc.get_multi(['k1', 'k2', 'nonexist'], key_prefix='pfx_') == {'k1' : 1, 'k2' : 2} 1 get_mult [ and L{set_multi} ] can take str()-ables like ints / longs as keys too. Such as your db pri key fields. They're rotored through str() before being passed off to memcache, with or without the use of a key_prefix. In this mode, the key_prefix could be a table name, and the key itself a db primary key number. >>> mc.set_multi({42: 'douglass adams', 46 : 'and 2 just ahead of me'}, key_prefix='numkeys_') == [] 1 >>> mc.get_multi([46, 42], key_prefix='numkeys_') == {42: 'douglass adams', 46 : 'and 2 just ahead of me'} 1 This method is recommended over regular L{get} as it lowers the number of total packets flying around your network, reducing total latency, since your app doesn't have to wait for each round-trip of L{get} before sending the next one. See also L{set_multi}. @param keys: An array of keys. @param key_prefix: A string to prefix each key when we communicate with memcache. Facilitates pseudo-namespaces within memcache. Returned dictionary keys will not have this prefix. @return: A dictionary of key/value pairs that were available. If key_prefix was provided, the keys in the retured dictionary will not have it present. s get_multisget %ss isENDN(sselfs_statlogs_map_and_prefix_keysskeyss key_prefixs server_keyssprefixed_to_orig_keys dead_serverssiterkeyssserverssend_cmdsjoinssocketserrorsmsgs mark_deadsappendsretvalssreadlineslines _expectvaluesrkeysflagssrlensNones _recv_valuesvals_Error(sselfskeyss key_prefixs server_keyssrlensvalsrkeysservers dead_serverssflagssmsgsretvalssprefixed_to_orig_keysline((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys get_multits:$  "    cCs{| o|iƒ}n|d djoA|iƒ\}}}}t|ƒ}t|ƒ}|||fSnt t t fSdS(NisVALUE( slinesserversreadlinessplitsrespsrkeysflagsslensintsrlensNone(sselfsserverslinesrlensrkeyslensflagssresp((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys _expectvalueºs  c Css|d7}|i|ƒ}t|ƒ|jo tdt|ƒ|fƒ‚nt|ƒ|jo|d }n|ti@ot |ƒ}n|djp |tijo |}nº|ti @ot |ƒ}nœ|ti @ot|ƒ}n~|ti@o^y+t|ƒ}|i|ƒ}|iƒ}Wqktj o }|id|ƒt}qkXn|id|ƒ|SdS(Nis#received %d bytes when expecting %diþÿÿÿisPickle error: %s sunknown flags on get: %x (srlensserversrecvsbufslens_ErrorsflagssClients_FLAG_COMPRESSEDs decompresssvals _FLAG_INTEGERsints _FLAG_LONGslongs _FLAG_PICKLEsStringIOsfilesselfs unpicklersloads ExceptionsesdebuglogsNone( sselfsserversflagssrlensesvalsfilesbufs unpickler((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys _recv_valueÆs0    (+s__name__s __module__s__doc__s _FLAG_PICKLEs _FLAG_INTEGERs _FLAG_LONGs_FLAG_COMPRESSEDs_SERVER_RETRIESs ExceptionsMemcachedKeyErrorsMemcachedKeyLengthErrorsMemcachedKeyCharacterErrorsMemcachedStringEncodingErrorspicklesPicklers Unpicklers__init__s set_serverss get_statss flush_allsdebuglogs_statlogsforget_dead_hostss _init_bucketss _get_serversdisconnect_alls delete_multisdeletesincrsdecrs _incrdecrsaddsreplacessets_map_and_prefix_keyss set_multis_val_to_store_infos_setsgets get_multisNones _expectvalues _recv_value(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysClient_sH             A      'O &   F s_HostcBs}tZdZed„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „ZRS(NicCsËt|tiƒo|\}|_n d|_|idƒdjo1|idƒ\|_|_ t |i ƒ|_ n|df\|_|_ | o d„}n||_ d|_ t|_d|_dS(Nis:iiË+cCs|S(N(sx(sx((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysøss(s isinstanceshoststypess TupleTypesselfsweightsfindssplitsipsportsints debugfuncsdebuglogs deaduntilsNonessocketsbuffer(sselfshosts debugfunc((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys__init__ës     cCs9|io|itiƒjodSnd|_dSdS(Nii(sselfs deaduntilstime(sself((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys _check_deads  cCs|iƒodSndSdS(Nii(sselfs _get_socket(sself((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysconnects cCs;|id||fƒtiƒti|_|iƒdS(Ns MemCache: %s: %s. Marking dead.(sselfsdebuglogsreasonstimes_Hosts _DEAD_RETRYs deaduntils close_socket(sselfsreason((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys mark_dead scCs­|iƒotSn|io |iSntititiƒ}y|i|i|i fƒWn1ti j o"}|i d|dƒtSnX||_d|_ |SdS(Ns connect: %sis(sselfs _check_deadsNonessocketsAF_INETs SOCK_STREAMsssconnectsipsportserrorsmsgs mark_deadsbuffer(sselfsmsgss((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys _get_sockets      cCs(|io|iiƒt|_ndS(N(sselfssocketsclosesNone(sself((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys close_socket s  cCs|ii|dƒdS(Ns (sselfssocketssendallscmd(sselfscmd((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pyssend_cmd%scCs|ii|ƒdS(s( cmds already has trailing 's applied N(sselfssocketssendallscmds(sselfscmds((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys send_cmds(scCs¼|i}|ii}xgto_|idƒ}|djoPn|dƒ}| o|i dt |ƒƒPn||7}qW|djo||d|_|| }n d|_|SdS(Ns iis'Connection closed while reading from %sis( sselfsbuffersbufssocketsrecvsTruesfindsindexsdatas mark_deadsrepr(sselfsindexsbufsdatasrecv((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysreadline,s"      cCs<|iƒ}||jo|id||fƒn|SdS(Ns2while expecting '%s', got unexpected response '%s'(sselfsreadlineslinestextsdebuglog(sselfstextsline((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysexpect@s  cCs|ii}|i}x^t|ƒ|joJ|dƒ}||7}t|ƒdjot dt|ƒ|f‚qqW|||_|| SdS(Niis9Read %d bytes, expecting %d, read returned 0 length bytes( sselfssocketsrecvsself_socket_recvsbuffersbufslensrlensfoos_Error(sselfsrlensself_socket_recvsfoosbuf((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysrecvFs    " cCs<d}|iod|i}nd|i|i|fSdS(Nss (dead until %d)s%s:%d%s(sdsselfs deaduntilsipsport(sselfsd((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys__str__Rs (s__name__s __module__s _DEAD_RETRYsNones__init__s _check_deadsconnects mark_deads _get_sockets close_socketssend_cmds send_cmdssreadlinesexpectsrecvs__str__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys_Hostès           icCs˜t|tƒ otid‚nt|tƒoct|ƒ|tjoti dt‚nx5|D])}t |ƒdjoti d‚qcqcWndS(søChecks sanity of key. Fails if: Key length is > SERVER_MAX_KEY_LENGTH (Raises MemcachedKeyLength). Contains control characters (Raises MemcachedKeyCharacterError). Is not a string (Raises MemcachedStringEncodingError) s_Keys must be str()'s, notunicode. Convert your unicode strings using mystring.encode(charset)!sKey length is > %si!sControl characters not allowedN( s isinstanceskeysstrsClientsMemcachedStringEncodingErrors basestringslens key_extra_lensSERVER_MAX_KEY_LENGTHsMemcachedKeyLengthErrorscharsordsMemcachedKeyCharacterError(skeys key_extra_lenschar((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys check_keyXscCsSdk}dk}dg}t|ddƒ}hd|<}|i|d|ƒSdS(Ns127.0.0.1:11211sdebugismcsglobs(sdoctestsmemcachesserverssClientsmcsglobsstestmod(smcsmemcachesserverssdoctestsglobs((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys_doctestks  s__main__sTesting docstrings...sRunning tests:s127.0.0.1:11211sdebugicCs8t|tiƒ od|t|ƒfSnd|SdS(Ns%s (%s)s%s(s isinstancesvalstypess StringTypesstype(sval((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pysto_s{scCs`dt|ƒt|ƒfGti||ƒti|ƒ}||jo dGHdSn dGHdSdS(NsTesting set/get {'%s': %s} ...sOKisFAILi(sto_sskeysvalsmcssetsgetsnewval(skeysvalsnewval((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys test_setgets s FooStructcBs#tZd„Zd„Zd„ZRS(NcCs d|_dS(Nsbaz(sselfsbar(sself((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys__init__ŒscCsdSdS(Ns A FooStruct((sself((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys__str__ŽscCs,t|tƒo|i|ijSndSdS(Ni(s isinstancesothers FooStructsselfsbar(sselfsother((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys__eq__s(s__name__s __module__s__init__s__str__s__eq__(((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys FooStruct‹s  sa_stringssome random strings an_integeri*slongisTesting delete ...sOKsFAILsTesting get_multi ...sTesting get(unknown value) ...s unknown_values foostructsTesting incr ...i+sTesting decr ...sTesting sending spaces...sthis has spacess%Testing sending control characters...sthishascontrol characterss"Testing using insanely long key...sasaaaas'Testing sending a unicode-string key...ukeyhereuasutf-8s V\u4f1a p0 .s>Testing using a value larger than the memcached value limit...skeyheresaaa(9s__doc__ssysssocketstimestypesscPicklespickles ImportErrorszlibscompresss decompresssTrues_supports_compresssFalses cStringIOsStringIOsbinasciiscrc32sserverHashFunctions __author__s __version__s __copyright__s __license__sSERVER_MAX_KEY_LENGTHsSERVER_MAX_VALUE_LENGTHs Exceptions_Errors threadingslocalsobjectsClients_Hosts check_keys_doctests__name__sserverssmcsto_ss test_setgets FooStructslongsdeletes get_multisgetsfsincrsxsdecrssetsMemcachedKeyCharacterErrorsmsgsMemcachedKeyLengthErrorsMemcachedStringEncodingErrorsencodesloadssssNone( sserverss_doctestsss test_setgetsSERVER_MAX_VALUE_LENGTHsmsgs __version__s check_keys_Errors __license__scompresss decompressssyssClientsSERVER_MAX_KEY_LENGTHscrc32s __author__stypessto_ss __copyright__sserverHashFunctionssocketsmcsStringIOslocalsfs FooStructs_supports_compressstimes_Hostsxspickle((sP/mnt/gmirror/ports/databases/py-memcached/work/python-memcached-1.39/memcache.pys?,sæ        ÿÿ‹p                    # #