+
    üÐjc\  ã                   óØ   € R t ^ RIHt ^ RIHtHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHtHt Rt ! R R	]4      t ! R
 R]4      t ! R R]4      t ! R R4      t ! R R]]
4      t. ROtR# )ap  
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 L{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
L{MemCacheProtocol.set} and L{MemCacheProtocol.get} are the more important.

See U{http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt} for
more information about the protocol.
)Údeque)ÚDeferredÚTimeoutErrorÚfail)ÚLineReceiver)ÚTimeoutMixin)Úlog)ÚnativeStringÚnetworkStringiË+  c                   ó   € ] tR t^(tRtRtR# )ÚNoSuchCommandz9
Exception raised when a non existent command is called.
© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú</usr/lib/python3/dist-packages/twisted/protocols/memcache.pyr   r   (   ó   † õr   r   c                   ó   € ] tR t^.tRtRtR# )ÚClientErrorz)
Error caused by an invalid client call.
r   Nr   r   r   r   r   r   .   r   r   r   c                   ó   € ] tR t^4tRtRtR# )ÚServerErrorz"
Problem happening on the server.
r   Nr   r   r   r   r   r   4   r   r   r   c                   ó6   a € ] tR t^:t o RtR tR tR tRtV t	R# )ÚCommanda  
Wrap a client action into an object, that holds the values used in the
protocol.

@ivar _deferred: the L{Deferred} object that will be fired when the result
    arrives.
@type _deferred: L{Deferred}

@ivar command: name of the command sent to the server.
@type command: L{bytes}
c                óz   € Wn         \        4       V n        VP                  4        F  w  r4\	        WV4       K  	  R# )z¯
Create a command.

@param command: the name of the command.
@type command: L{bytes}

@param kwargs: this values will be stored as attributes of the object
    for future use
N)Úcommandr   Ú	_deferredÚitemsÚsetattr)Úselfr   ÚkwargsÚkÚvs   &&,  r   Ú__init__ÚCommand.__init__G   s.   € ð ŒÜ!›ˆŒØ—L‘L–N‰DˆAÜ�D˜QÖó #r   c                ó<   € V P                   P                  V4       R# )z2
Shortcut method to fire the underlying deferred.
N)r    Úcallback)r#   Úvalues   &&r   ÚsuccessÚCommand.successV   s   € ð 	�‰×Ñ Ö&r   c                ó<   € V P                   P                  V4       R# )z%
Make the underlying deferred fails.
N)r    Úerrback)r#   Úerrors   &&r   r   ÚCommand.fail\   s   € ð 	�‰×Ñ˜uÖ%r   )r    r   N)
r   r   r   r   r   r'   r,   r   r   Ú__classdictcell__©Ú__classdict__s   @r   r   r   :   s   ø‡ € ñ
ò ò'÷&ð &r   r   c                   ó2  a € ] tR t^ct o Rt^útRtR*R ltR tR t	R t
R tR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR+R ltR+R ltR tR,R ltR,R ltR,R lt R,R lt!R t"R t#R  t$R-R! lt%R-R" lt&R# t'R.R% lt(R& t)R' t*R( t+R)t,V t-R$# )/ÚMemCacheProtocolaí  
MemCache protocol: connect to a memcached server to store/retrieve values.

@ivar persistentTimeOut: the timeout period used to wait for a response.
@type persistentTimeOut: L{int}

@ivar _current: current list of requests waiting for an answer from the
    server.
@type _current: L{deque} of L{Command}

@ivar _lenExpected: amount of data expected in raw mode, when reading for
    a value.
@type _lenExpected: L{int}

@ivar _getBuffer: current buffer of data, used to store temporary data
    when reading in raw mode.
@type _getBuffer: L{list}

@ivar _bufferLength: the total amount of bytes in C{_getBuffer}.
@type _bufferLength: L{int}

@ivar _disconnected: indicate if the connectionLost has been called or not.
@type _disconnected: L{bool}
Fc                ój   € \        4       V n        RV n        RV n        RV n        V;V n        V n        R# )z«
Create the protocol.

@param timeOut: the timeout to wait before detecting that the
    connection is dead and close it. It's expressed in seconds.
@type timeOut: L{int}
N)r   Ú_currentÚ_lenExpectedÚ
_getBufferÚ_bufferLengthÚpersistentTimeOutÚtimeOut)r#   r=   s   &&r   r'   ÚMemCacheProtocol.__init__€   s3   € ô ›ˆŒØ ˆÔØˆŒØ!ˆÔØ07Ð7ˆÔ ¦r   c                ó„   € V P                   '       d.   V P                   P                  4       pVP                  V4       K?  R# )zG
Cancel all the outstanding commands, making them fail with C{reason}.
N)r8   Úpopleftr   )r#   ÚreasonÚcmds   && r   Ú_cancelCommandsÚ MemCacheProtocol._cancelCommandsŽ   s0   € ð �m�mˆmØ—-‘-×'Ñ'Ó)ˆCØ�H‰H�VÖñ r   c                ón   € V P                  \        R4      4       V P                  P                  4        R# )z*
Close the connection in case of timeout.
zConnection timeoutN)rC   r   Ú	transportÚloseConnection©r#   s   &r   ÚtimeoutConnectionÚ"MemCacheProtocol.timeoutConnection–   s(   € ð 	×Ñœ\Ð*>Ó?Ô@Ø�‰×%Ñ%Ö'r   c                ób   € RV n         V P                  V4       \        P                  ! W4       R# )z)
Cause any outstanding commands to fail.
TN)Ú_disconnectedrC   r   ÚconnectionLost)r#   rA   s   &&r   rM   ÚMemCacheProtocol.connectionLost�   s(   € ð "ˆÔØ×Ñ˜VÔ$Ü×#Ò# DÖ1r   c                óŒ   € V P                   '       g   V P                  V P                  4       \        P                  ! W4       R# )z1
Override sendLine to add a timeout to response.
N)r8   Ú
setTimeoutr<   r   ÚsendLine)r#   Úlines   &&r   rQ   ÚMemCacheProtocol.sendLine¥   s-   € ð �}�}ˆ}Ø�O‰O˜D×2Ñ2Ô3Ü×Ò˜dÖ)r   c                ó‚  € V P                  4        V P                  P                  V4       V ;P                  \	        V4      ,          un        V P                  V P
                  ^,           8¼  dÐ   RP                  V P                  4      pVRV P
                   pWP
                  ^,           R pTpRV n        RV n        RV n        V P                  ^ ,          pVP                  '       d<   VP                  VP                  ,          w  rgWgV3VP                  VP                  &   MWEn        V P                  V4       R# R# )z
Collect data for a get.
r   N)ÚresetTimeoutr:   Úappendr;   Úlenr9   Újoinr8   ÚmultipleÚvaluesÚ
currentKeyr+   ÚsetLineMode)r#   ÚdataÚbufÚremÚvalrB   ÚflagsÚcass   &&      r   ÚrawDataReceivedÚ MemCacheProtocol.rawDataReceived­   s  € ð 	×ÑÔØ�‰×Ñ˜tÔ$Ø×Òœc $›iÕ'ÕØ×Ñ ×!2Ñ!2°QÕ!6Ô6Ø—8‘8˜DŸO™OÓ,ˆDØÐ*˜×*Ñ*Ð+ˆCØ×(Ñ(¨1Õ,Ð.Ð/ˆCØˆCØ $ˆDÔØ"ˆDŒOØ!%ˆDÔØ—-‘- Õ"ˆCØ�|�|ˆ|Ø ŸZ™Z¨¯©Õ7‘
�Ø.3¸#Ð->�—
‘
˜3Ÿ>™>Ò*à”	Ø×Ñ˜SÖ!ñ 7r   c                óX   € V P                   P                  4       P                  R4       R# )z/
Manage a success response to a set operation.
TN©r8   r@   r,   rH   s   &r   Ú
cmd_STOREDÚMemCacheProtocol.cmd_STOREDÄ   ó   € ð 	�‰×ÑÓ×'Ñ'¨Ö-r   c                óX   € V P                   P                  4       P                  R4       R# )zr
Manage a specific 'not stored' response to a set operation: this is not
an error, but some condition wasn't met.
FNrf   rH   s   &r   Úcmd_NOT_STOREDÚMemCacheProtocol.cmd_NOT_STOREDÊ   s   € ð
 	�‰×ÑÓ×'Ñ'¨Ö.r   c                ó  € V P                   P                  4       pVP                  R8X  dƒ   VP                  '       dH   VP                  P                  4        UUu/ uF  w  r#W#R,          bK  	  pppVP                  V4       R# VP                  VP                  VP                  34       R# VP                  R8X  dd   VP                  '       d   VP                  VP                  4       R# VP                  VP                  VP                  VP                  34       R# VP                  R8X  d   VP                  VP                  4       R# \        RP                  \        VP                  4      4      4      hu uppi )z2
This the end token to a get or a stat operation.
ó   get:NNé   ó   getsó   statsz%Unexpected END response to {} commandN)r8   r@   r   rY   rZ   r!   r,   ra   r+   rb   ÚRuntimeErrorÚformatr	   )r#   rB   Úkeyr`   rZ   s   &    r   Úcmd_ENDÚMemCacheProtocol.cmd_ENDÑ   s  € ð �m‰m×#Ñ#Ó%ˆØ�;‰;˜&Ô Ø�|�|ˆ|Ø8;¿
¹
×8HÑ8HÔ8JÔKÑ8J©H¨C˜# 3�xš-Ñ8J�ÑKØ—‘˜FÖ#à—‘˜SŸY™Y¨¯	©	Ð2Ö3Ø�[‰[˜GÔ#Ø�|�|ˆ|Ø—‘˜CŸJ™JÖ'à—‘˜SŸY™Y¨¯©°·±Ð;Ö<Ø�[‰[˜HÔ$Ø�K‰K˜Ÿ
™
Ö#äØ7×>Ñ>Ü  §¡Ó-óóð ùó Ls   ÁE=c                óX   € V P                   P                  4       P                  R4       R# )z-
Manage error response for incr/decr/delete.
FNrf   rH   s   &r   Úcmd_NOT_FOUNDÚMemCacheProtocol.cmd_NOT_FOUNDê   ó   € ð 	�‰×ÑÓ×'Ñ'¨Ö.r   c                óü  € V P                   ^ ,          pVP                  R8X  d   VP                  4       w  r4pRpMVP                  4       w  r4rV\        V4      V n        . V n        ^ V n        VP                  '       d=   W2P                  9  d   \        R4      hW2n
        \        V4      V.VP                  V&   M2VP                  V8w  d   \        R4      h\        V4      Vn        Wbn        V P                  4        R# )z*
Prepare the reading a value after a get.
rn   r   zUnexpected commands answer.N)r8   r   ÚsplitÚintr9   r:   r;   rY   Úkeysrr   r[   rZ   rt   ra   rb   Ú
setRawMode)r#   rR   rB   rt   ra   Úlengthrb   s   &&     r   Ú	cmd_VALUEÚMemCacheProtocol.cmd_VALUEð   sÉ   € ð �m‰m˜AÕˆØ�;‰;˜&Ô Ø!%§¡£ÑˆC˜Ø‰Cà&*§j¡j£lÑ#ˆC˜Ü ›KˆÔØˆŒØˆÔØ�<�<ˆ<ØŸ(™(Ô"Ü"Ð#@ÓAÐAØ ŒNÜ" 5›z¨3Ð/ˆC�J‰J�sŠOà�w‰w˜#Œ~Ü"Ð#@ÓAÐAÜ˜E›
ˆCŒIØŒGØ�‰Ör   c                óp   € V P                   ^ ,          pVP                  R^4      w  r4WBP                  V&   R# )z
Reception of one stat line.
ó    N)r8   r|   rZ   )r#   rR   rB   rt   r`   s   &&   r   Úcmd_STATÚMemCacheProtocol.cmd_STAT	  s/   € ð �m‰m˜AÕˆØ—:‘:˜d AÓ&‰ˆØ�
‰
�3‹r   c                óX   € V P                   P                  4       P                  V4       R# )z
Read version token.
Nrf   )r#   ÚversionDatas   &&r   Úcmd_VERSIONÚMemCacheProtocol.cmd_VERSION  s   € ð 	�‰×ÑÓ×'Ñ'¨Ö4r   c                ó˜   € \         P                  ! R4       V P                  P                  4       pVP	                  \        4       4       R# )z'
A non-existent command has been sent.
zNon-existent command sent.N)r   Úerrr8   r@   r   r   )r#   rB   s   & r   Ú	cmd_ERRORÚMemCacheProtocol.cmd_ERROR  s1   € ô 	�ŠÐ,Ô-Ø�m‰m×#Ñ#Ó%ˆØ�‰”“Ö!r   c                ó¾   € \        V4      p\        P                  ! RV,           4       V P                  P	                  4       pVP                  \        V4      4       R# )z 
An invalid input as been sent.
zInvalid input: N)Úreprr   rŒ   r8   r@   r   r   ©r#   ÚerrTextrB   s   && r   Úcmd_CLIENT_ERRORÚ!MemCacheProtocol.cmd_CLIENT_ERROR  sB   € ô �w“-ˆÜ�ŠÐ! GÕ+Ô,Ø�m‰m×#Ñ#Ó%ˆØ�‰”˜WÓ%Ö&r   c                ó¾   € \        V4      p\        P                  ! RV,           4       V P                  P	                  4       pVP                  \        V4      4       R# )z$
An error has happened server-side.
zServer error: N)r�   r   rŒ   r8   r@   r   r   r‘   s   && r   Úcmd_SERVER_ERRORÚ!MemCacheProtocol.cmd_SERVER_ERROR(  sB   € ô �w“-ˆÜ�ŠÐ  7Õ*Ô+Ø�m‰m×#Ñ#Ó%ˆØ�‰”˜WÓ%Ö&r   c                óX   € V P                   P                  4       P                  R4       R# )z.
A delete command has completed successfully.
TNrf   rH   s   &r   Úcmd_DELETEDÚMemCacheProtocol.cmd_DELETED1  ri   r   c                óX   € V P                   P                  4       P                  R4       R# )z&
The last command has been completed.
TNrf   rH   s   &r   Úcmd_OKÚMemCacheProtocol.cmd_OK7  ri   r   c                óX   € V P                   P                  4       P                  R4       R# )z%
A C{checkAndSet} update has failed.
FNrf   rH   s   &r   Ú
cmd_EXISTSÚMemCacheProtocol.cmd_EXISTS=  rz   r   c                ó8  € V P                  4        VP                  R^4      ^ ,          p\        V R\        V4      ,           R4      pVe:   VP                  R^4      R,          pV'       d   V! V^ ,          4       MyV! 4        MqVP	                  RR4      p\        V R\        V4      ,           R4      pVe	   V! 4        M6V P
                  P                  4       p\        V4      pVP                  V4       V P
                  '       g   V P                  R4       R# R# )z(
Receive line commands from the server.
r„   Úcmd_N:é   NNó   _)
rU   r|   Úgetattrr	   Úreplacer8   r@   r}   r,   rP   )r#   rR   ÚtokenrB   Úargsr`   s   &&    r   ÚlineReceivedÚMemCacheProtocol.lineReceivedC  sá   € ð 	×ÑÔØ—
‘
˜4 Ó# AÕ&ˆä�d˜F¤\°%Ó%8Õ8¸$Ó?ˆØŠ?Ø—:‘:˜d AÓ& rÕ*ˆDßÙ�D˜•G•á•ð —<‘<  dÓ+ˆDÜ˜$ ¬°dÓ);Õ ;¸TÓBˆCØŠÙ•ð —m‘m×+Ñ+Ó-�Ü˜$“i�Ø—‘˜CÔ Ø�}�}ˆ}à�O‰O˜DÖ!ñ r   c                ó&   € V P                  RW4      # )an  
Increment the value of C{key} by given value (default to 1).
C{key} must be consistent with an int. Return the new value.

@param key: the key to modify.
@type key: L{bytes}

@param val: the value to increment.
@type val: L{int}

@return: a deferred with will be called back with the new value
    associated with the key (after the increment).
@rtype: L{Deferred}
s   incr©Ú	_incrdecr©r#   rt   r`   s   &&&r   Ú	incrementÚMemCacheProtocol.increment`  s   € ð �~‰~˜g sÓ0Ð0r   c                ó&   € V P                  RW4      # )aˆ  
Decrement the value of C{key} by given value (default to 1).
C{key} must be consistent with an int. Return the new value, coerced to
0 if negative.

@param key: the key to modify.
@type key: L{bytes}

@param val: the value to decrement.
@type val: L{int}

@return: a deferred with will be called back with the new value
    associated with the key (after the decrement).
@rtype: L{Deferred}
s   decrr¬   r®   s   &&&r   Ú	decrementÚMemCacheProtocol.decrementq  s   € ð  �~‰~˜g sÓ0Ð0r   c                óè  € V P                   '       d   \        \        R4      4      # \        V\        4      '       g"   \        \        R\        V4       R24      4      # \        V4      V P                  8”  d   \        \        R4      4      # RP                  WR\        V4      3,          .4      pV P                  V4       \        WR7      pV P                  P                  V4       VP                  # )z!
Internal wrapper for incr/decr.
únot connectedúInvalid type for key: ú, expecting bytesúKey too longr„   s   %d©rt   )rL   r   rr   Ú
isinstanceÚbytesr   ÚtyperW   ÚMAX_KEY_LENGTHrX   r}   rQ   r   r8   rV   r    )r#   rB   rt   r`   ÚfullcmdÚcmdObjs   &&&&  r   r­   ÚMemCacheProtocol._incrdecrƒ  sÇ   € ð ××ÐÜœ _Ó5Ó6Ð6Ü˜#œu×%Ò%ÜÜÐ4´T¸#³Y°KÐ?PÐQÓRóð ô ˆs‹8�d×)Ñ)Ô)Üœ NÓ3Ó4Ð4Ø—)‘)˜S u´°C³¨{Õ':Ð;Ó<ˆØ�‰�gÔÜ˜Ô&ˆØ�‰×Ñ˜VÔ$Ø×ÑÐr   c                ó*   € V P                  RWW4R4      # )a-  
Replace the given C{key}. It must already exist in the server.

@param key: the key to replace.
@type key: L{bytes}

@param val: the new value associated with the key.
@type val: L{bytes}

@param flags: the flags to store with the key.
@type flags: L{int}

@param expireTime: if different from 0, the relative time in seconds
    when the key will be deleted from the store.
@type expireTime: L{int}

@return: a deferred that will fire with C{True} if the operation has
    succeeded, and C{False} with the key didn't previously exist.
@rtype: L{Deferred}
s   replacer   ©Ú_set©r#   rt   r`   ra   Ú
expireTimes   &&&&&r   r¦   ÚMemCacheProtocol.replace•  s   € ð* �y‰y˜ S¨uÀ#ÓFÐFr   c                ó*   € V P                  RWW4R4      # )a  
Add the given C{key}. It must not exist in the server.

@param key: the key to add.
@type key: L{bytes}

@param val: the value associated with the key.
@type val: L{bytes}

@param flags: the flags to store with the key.
@type flags: L{int}

@param expireTime: if different from 0, the relative time in seconds
    when the key will be deleted from the store.
@type expireTime: L{int}

@return: a deferred that will fire with C{True} if the operation has
    succeeded, and C{False} with the key already exists.
@rtype: L{Deferred}
s   addr   rÂ   rÄ   s   &&&&&r   ÚaddÚMemCacheProtocol.add¬  ó   € ð* �y‰y˜ ¨5¸cÓBÐBr   c                ó*   € V P                  RWW4R4      # )aÉ  
Set the given C{key}.

@param key: the key to set.
@type key: L{bytes}

@param val: the value associated with the key.
@type val: L{bytes}

@param flags: the flags to store with the key.
@type flags: L{int}

@param expireTime: if different from 0, the relative time in seconds
    when the key will be deleted from the store.
@type expireTime: L{int}

@return: a deferred that will fire with C{True} if the operation has
    succeeded.
@rtype: L{Deferred}
s   setr   rÂ   rÄ   s   &&&&&r   ÚsetÚMemCacheProtocol.setÃ  rÊ   r   c                ó*   € V P                  RWWEV4      # )aÝ  
Change the content of C{key} only if the C{cas} value matches the
current one associated with the key. Use this to store a value which
hasn't been modified since last time you fetched it.

@param key: The key to set.
@type key: L{bytes}

@param val: The value associated with the key.
@type val: L{bytes}

@param cas: Unique 64-bit value returned by previous call of C{get}.
@type cas: L{bytes}

@param flags: The flags to store with the key.
@type flags: L{int}

@param expireTime: If different from 0, the relative time in seconds
    when the key will be deleted from the store.
@type expireTime: L{int}

@return: A deferred that will fire with C{True} if the operation has
    succeeded, C{False} otherwise.
@rtype: L{Deferred}
s   casrÂ   )r#   rt   r`   rb   ra   rÅ   s   &&&&&&r   ÚcheckAndSetÚMemCacheProtocol.checkAndSetÚ  s   € ð4 �y‰y˜ ¨5¸cÓBÐBr   c           
     óÂ  € V P                   '       d   \        \        R4      4      # \        V\        4      '       g"   \        \        R\        V4       R24      4      # \        V4      V P                  8”  d   \        \        R4      4      # \        V\        4      '       g"   \        \        R\        V4       R24      4      # V'       d
   RV,           p\        V4      pRP                  W\        RWEV3,          4      .4      V,           pV P                  V4       V P                  V4       \        WWGR7      p	V P                  P                  V	4       V	P                  # )	z&
Internal wrapper for setting values.
rµ   r¶   r·   r¸   zInvalid type for value: r„   z%d %d %d)rt   ra   r€   )rL   r   rr   rº   r»   r   r¼   rW   r½   rX   r
   rQ   r   r8   rV   r    )
r#   rB   rt   r`   ra   rÅ   rb   r€   r¾   r¿   s
   &&&&&&&   r   rÃ   ÚMemCacheProtocol._setö  s3  € ð ××ÐÜœ _Ó5Ó6Ð6Ü˜#œu×%Ò%ÜÜÐ4´T¸#³Y°KÐ?PÐQÓRóð ô ˆs‹8�d×)Ñ)Ô)Üœ NÓ3Ó4Ð4Ü˜#œu×%Ò%ÜÜÐ6´t¸C³y°kÐARÐSÓTóð ÷ Ø˜•*ˆCÜ�S“ˆà�I‰IØœ=¨°uÈ&Ð6QÕ)QÓRÐSóð õð 	ð 	�‰�gÔØ�‰�cÔÜ˜¨UÔBˆØ�‰×Ñ˜VÔ$Ø×ÑÐr   c                ó,   € V P                  RW^ ^ R4      # )aL  
Append given data to the value of an existing key.

@param key: The key to modify.
@type key: L{bytes}

@param val: The value to append to the current value associated with
    the key.
@type val: L{bytes}

@return: A deferred that will fire with C{True} if the operation has
    succeeded, C{False} otherwise.
@rtype: L{Deferred}
s   appendr   rÂ   r®   s   &&&r   rV   ÚMemCacheProtocol.append  s   € ð  �y‰y˜ C¨a°°CÓ8Ð8r   c                ó,   € V P                  RW^ ^ R4      # )aN  
Prepend given data to the value of an existing key.

@param key: The key to modify.
@type key: L{bytes}

@param val: The value to prepend to the current value associated with
    the key.
@type val: L{bytes}

@return: A deferred that will fire with C{True} if the operation has
    succeeded, C{False} otherwise.
@rtype: L{Deferred}
s   prependr   rÂ   r®   s   &&&r   ÚprependÚMemCacheProtocol.prepend'  s   € ð  �y‰y˜ S¨q°!°SÓ9Ð9r   c                ó*   € V P                  V.VR4      # )a6  
Get the given C{key}. It doesn't support multiple keys. If
C{withIdentifier} is set to C{True}, the command issued is a C{gets},
that will return the current identifier associated with the value. This
identifier has to be used when issuing C{checkAndSet} update later,
using the corresponding method.

@param key: The key to retrieve.
@type key: L{bytes}

@param withIdentifier: If set to C{True}, retrieve the current
    identifier along with the value and the flags.
@type withIdentifier: L{bool}

@return: A deferred that will fire with the tuple (flags, value) if
    C{withIdentifier} is C{False}, or (flags, cas identifier, value)
    if C{True}.  If the server indicates there is no value
    associated with C{key}, the returned value will be L{None} and
    the returned flags will be C{0}.
@rtype: L{Deferred}
F©Ú_get)r#   rt   ÚwithIdentifiers   &&&r   ÚgetÚMemCacheProtocol.get9  s   € ð, �y‰y˜#˜ °Ó6Ð6r   c                ó&   € V P                  WR4      # )at  
Get the given list of C{keys}.  If C{withIdentifier} is set to C{True},
the command issued is a C{gets}, that will return the identifiers
associated with each values. This identifier has to be used when
issuing C{checkAndSet} update later, using the corresponding method.

@param keys: The keys to retrieve.
@type keys: L{list} of L{bytes}

@param withIdentifier: If set to C{True}, retrieve the identifiers
    along with the values and the flags.
@type withIdentifier: L{bool}

@return: A deferred that will fire with a dictionary with the elements
    of C{keys} as keys and the tuples (flags, value) as values if
    C{withIdentifier} is C{False}, or (flags, cas identifier, value) if
    C{True}.  If the server indicates there is no value associated with
    C{key}, the returned values will be L{None} and the returned flags
    will be C{0}.
@rtype: L{Deferred}

@since: 9.0
TrÙ   )r#   r~   rÛ   s   &&&r   ÚgetMultipleÚMemCacheProtocol.getMultipleQ  s   € ð0 �y‰y˜¨tÓ4Ð4r   c           	     óŒ  € \        V4      pV P                  '       d   \        \        R4      4      # V Fl  p\	        V\
        4      '       g$   \        \        R\        V4       R24      4      u # \        V4      V P                  8”  g   KX  \        \        R4      4      u # 	  V'       d   RpMRpRP                  V.V,           4      pV P                  V4       V'       d!   V Uu/ uF  qDRbK  	  pp\        WQVR
R7      pM\        WQ^ ,          R	^ RRR7      pV P                  P                  V4       VP                  # u upi )z.
Helper method for C{get} and C{getMultiple}.
rµ   r¶   r·   r¸   rp   rn   r„   r   NT)r~   rZ   rY   F)rt   r+   ra   rb   rY   )é    r   N)ÚlistrL   r   rr   rº   r»   r   r¼   rW   r½   rX   rQ   r   r8   rV   r    )	r#   r~   rÛ   rY   rt   rB   r¾   rZ   r¿   s	   &&&&     r   rÚ   ÚMemCacheProtocol._getk  s  € ô �D‹zˆØ××ÐÜœ _Ó5Ó6Ð6ÛˆCÜ˜c¤5×)Ò)ÜÜÐ"8¼¸c»¸ÐCTÐ UÓVóò ô �3‹x˜$×-Ñ-Ö-ÜœK¨Ó7Ó8Ò8ñ ÷ Ø‰CàˆCØ—)‘)˜S˜E D�LÓ)ˆØ�‰�gÔßÙ59Ó:±T¨c˜>Ò)±TˆFÐ:Ü˜S°FÀTÔJ‰FäØ˜a�¨°A¸3ÈôˆFð 	�‰×Ñ˜VÔ$Ø×ÑÐùò ;s   Ã'ENc                ó   € V'       d   RV,           pMRpV P                   '       d   \        \        R4      4      # V P                  V4       \	        R/ R7      pV P
                  P                  V4       VP                  # )a�  
Get some stats from the server. It will be available as a dict.

@param arg: An optional additional string which will be sent along
    with the I{stats} command.  The interpretation of this value by
    the server is left undefined by the memcache protocol
    specification.
@type arg: L{None} or L{bytes}

@return: a deferred that will fire with a L{dict} of the available
    statistics.
@rtype: L{Deferred}
s   stats rq   rµ   )rZ   ©rL   r   rr   rQ   r   r8   rV   r    )r#   ÚargrB   r¿   s   &&  r   ÚstatsÚMemCacheProtocol.stats‰  sg   € ÷ Ø˜c•/‰CàˆCØ××ÐÜœ _Ó5Ó6Ð6Ø�‰�cÔÜ˜¨"Ô-ˆØ�‰×Ñ˜VÔ$Ø×ÑÐr   c                óÔ   € V P                   '       d   \        \        R4      4      # V P                  R4       \	        R4      pV P
                  P                  V4       VP                  # )z‚
Get the version of the server.

@return: a deferred that will fire with the string value of the
    version.
@rtype: L{Deferred}
rµ   s   versionræ   ©r#   r¿   s   & r   ÚversionÚMemCacheProtocol.version¢  sT   € ð ××ÐÜœ _Ó5Ó6Ð6Ø�‰�jÔ!Ü˜Ó$ˆØ�‰×Ñ˜VÔ$Ø×ÑÐr   c                óT  € V P                   '       d   \        \        R4      4      # \        V\        4      '       g"   \        \        R\        V4       R24      4      # V P                  RV,           4       \        RVR7      pV P                  P                  V4       VP                  # )zÜ
Delete an existing C{key}.

@param key: the key to delete.
@type key: L{bytes}

@return: a deferred that will be called back with C{True} if the key
    was successfully deleted, or C{False} if not.
@rtype: L{Deferred}
rµ   r¶   r·   s   delete s   deleter¹   )rL   r   rr   rº   r»   r   r¼   rQ   r   r8   rV   r    )r#   rt   r¿   s   && r   ÚdeleteÚMemCacheProtocol.delete±  sŽ   € ð ××ÐÜœ _Ó5Ó6Ð6Ü˜#œu×%Ò%ÜÜÐ4´T¸#³Y°KÐ?PÐQÓRóð ð 	�‰�j 3Õ&Ô'Ü˜¨Ô,ˆØ�‰×Ñ˜VÔ$Ø×ÑÐr   c                óÔ   € V P                   '       d   \        \        R4      4      # V P                  R4       \	        R4      pV P
                  P                  V4       VP                  # )z�
Flush all cached values.

@return: a deferred that will be called back with C{True} when the
    operation has succeeded.
@rtype: L{Deferred}
rµ   s	   flush_allræ   rë   s   & r   ÚflushAllÚMemCacheProtocol.flushAllÇ  sT   € ð ××ÐÜœ _Ó5Ó6Ð6Ø�‰�lÔ#Ü˜Ó&ˆØ�‰×Ñ˜VÔ$Ø×ÑÐr   )r;   r8   rL   r:   r9   r<   r=   )é<   )r£   )râ   râ   )F)N).r   r   r   r   r   r½   rL   r'   rC   rI   rM   rQ   rc   rg   rk   ru   rx   r�   r…   r‰   r�   r“   r–   r™   rœ   rŸ   r©   r¯   r²   r­   r¦   rÈ   rÌ   rÏ   rÃ   rV   rÖ   rÜ   rß   rÚ   rè   rì   rï   rò   r   r2   r3   s   @r   r6   r6   c   sØ   ø‡ € ñð2 €NØ€Mô8òò(ò2ò*ò"ò..ò/òò2/òò2ò5ò"ò'ò'ò.ò.ò/ò"ô:1ô"1ò$ ô$Gô.Cô.Cô.Cò8 ò>9ò$:ô$7ô05ò4 ô< ò2 ò ÷, ð  r   r6   N)r6   ÚDEFAULT_PORTr   r   r   )r   Úcollectionsr   Útwisted.internet.deferr   r   r   Útwisted.protocols.basicr   Útwisted.protocols.policiesr   Útwisted.pythonr   Útwisted.python.compatr	   r
   rõ   Ú	Exceptionr   r   r   r   r6   Ú__all__r   r   r   Ú<module>rþ      sm   ðñ
õ0 ç ?Ñ ?Ý 0Ý 3Ý ß =à€ô�Iô ô�)ô ô�)ô ÷&&ñ &&ôRq	 �| \ô q	 òh‚r   