@@ -95,26 +95,6 @@ class GenericMemcachedBackend(CacheBackend):
9595
9696 .. versionadded:: 0.5.7
9797
98- :param memcached_expire_time: integer, when present will
99- be passed as the ``time`` parameter to ``pylibmc.Client.set``.
100- This is used to set the memcached expiry time for a value.
101-
102- .. note::
103-
104- This parameter is **different** from Dogpile's own
105- ``expiration_time``, which is the number of seconds after
106- which Dogpile will consider the value to be expired.
107- When Dogpile considers a value to be expired,
108- it **continues to use the value** until generation
109- of a new value is complete, when using
110- :meth:`.CacheRegion.get_or_create`.
111- Therefore, if you are setting ``memcached_expire_time``, you'll
112- want to make sure it is greater than ``expiration_time``
113- by at least enough seconds for new values to be generated,
114- else the value won't be available during a regeneration,
115- forcing all threads to wait for a regeneration each time
116- a value expires.
117-
11898 The :class:`.GenericMemachedBackend` uses a ``threading.local()``
11999 object to store individual client objects per thread,
120100 as most modern memcached clients do not appear to be inherently
@@ -147,7 +127,6 @@ def __init__(self, arguments):
147127 self .url = util .to_list (arguments ["url" ])
148128 self .distributed_lock = arguments .get ("distributed_lock" , False )
149129 self .lock_timeout = arguments .get ("lock_timeout" , 0 )
150- self .memcached_expire_time = arguments .get ("memcached_expire_time" , 0 )
151130
152131 def has_lock_timeout (self ):
153132 return self .lock_timeout != 0
@@ -222,6 +201,29 @@ def delete_multi(self, keys):
222201class MemcacheArgs (GenericMemcachedBackend ):
223202 """Mixin which provides support for the 'time' argument to set(),
224203 'min_compress_len' to other methods.
204+
205+ :param memcached_expire_time: integer, when present will
206+ be passed as the ``time`` parameter to the ``set`` method.
207+ This is used to set the memcached expiry time for a value.
208+
209+ .. note::
210+
211+ This parameter is **different** from Dogpile's own
212+ ``expiration_time``, which is the number of seconds after
213+ which Dogpile will consider the value to be expired.
214+ When Dogpile considers a value to be expired,
215+ it **continues to use the value** until generation
216+ of a new value is complete, when using
217+ :meth:`.CacheRegion.get_or_create`.
218+ Therefore, if you are setting ``memcached_expire_time``, you'll
219+ want to make sure it is greater than ``expiration_time``
220+ by at least enough seconds for new values to be generated,
221+ else the value won't be available during a regeneration,
222+ forcing all threads to wait for a regeneration each time
223+ a value expires.
224+
225+ :param min_compress_len: Threshold length to kick in auto-compression
226+ of the value using the compressor
225227 """
226228
227229 def __init__ (self , arguments ):
@@ -563,6 +565,28 @@ class PyMemcacheBackend(GenericMemcachedBackend):
563565
564566 .. versionadded:: 1.1.5
565567
568+ :param memcached_expire_time: integer, when present will
569+ be passed as the ``time`` parameter to the ``set`` method.
570+ This is used to set the memcached expiry time for a value.
571+
572+ .. note::
573+
574+ This parameter is **different** from Dogpile's own
575+ ``expiration_time``, which is the number of seconds after
576+ which Dogpile will consider the value to be expired.
577+ When Dogpile considers a value to be expired,
578+ it **continues to use the value** until generation
579+ of a new value is complete, when using
580+ :meth:`.CacheRegion.get_or_create`.
581+ Therefore, if you are setting ``memcached_expire_time``, you'll
582+ want to make sure it is greater than ``expiration_time``
583+ by at least enough seconds for new values to be generated,
584+ else the value won't be available during a regeneration,
585+ forcing all threads to wait for a regeneration each time
586+ a value expires.
587+
588+ .. versionadded:: 1.3.3
589+
566590 """ # noqa E501
567591
568592 def __init__ (self , arguments ):
@@ -594,6 +618,9 @@ def __init__(self, arguments):
594618 "enable_retry_client is not set; retry options "
595619 "will be ignored"
596620 )
621+ self .set_arguments = {}
622+ if "memcached_expire_time" in arguments :
623+ self .set_arguments ["expire" ] = arguments ["memcached_expire_time" ]
597624
598625 def _imports (self ):
599626 global pymemcache
0 commit comments