def __init__(self, servers=None, default_timeout=300, key_prefix=None): BaseCache.__init__(self, default_timeout=default_timeout) CachelibMemcachedCache.__init__( self, servers=servers, default_timeout=default_timeout, key_prefix=key_prefix, )
def __init__(self, threshold=500, default_timeout=300, ignore_errors=False): BaseCache.__init__(self, default_timeout=default_timeout) CachelibSimpleCache.__init__(self, threshold=threshold, default_timeout=default_timeout) self.ignore_errors = ignore_errors
def __init__(self, host="localhost", port=6379, password=None, db=0, default_timeout=300, key_prefix=None, **kwargs): BaseCache.__init__(self, default_timeout=default_timeout) CachelibRedisCache.__init__(self, host=host, port=port, password=password, db=db, default_timeout=default_timeout, key_prefix=key_prefix, **kwargs) self._write_client = self._read_clients = self._client
def __init__( self, cache_dir, threshold=500, default_timeout=300, mode=0o600, hash_method=hashlib.md5, ignore_errors=False, ): BaseCache.__init__(self, default_timeout=default_timeout) CachelibFileSystemCache.__init__( self, cache_dir=cache_dir, threshold=threshold, default_timeout=default_timeout, mode=mode, hash_method=hash_method, ) self.ignore_errors = ignore_errors
def __init__(self, default_timeout=300, cache=""): BaseCache.__init__(self, default_timeout=default_timeout) CachelibUWSGICache.__init__( self, cache=cache, default_timeout=default_timeout, ) try: import uwsgi self._uwsgi = uwsgi except ImportError as e: raise RuntimeError( "uWSGI could not be imported, are you running under uWSGI?" ) from e if "cache2" not in uwsgi.opt: raise RuntimeError( "You must enable cache2 in uWSGI configuration: " "https://uwsgi-docs.readthedocs.io/en/latest/Caching.html")
def _normalize_timeout(self, timeout): timeout = BaseCache._normalize_timeout(self, timeout) if timeout > 0: # NOTE: pylibmc expect the timeout as delta time up to # 2592000 seconds (30 days) if not hasattr(self, "mc_library"): try: import pylibmc # noqa except ImportError: self.mc_library = None else: self.mc_library = "pylibmc" if self.mc_library != "pylibmc": timeout = int(time()) + timeout elif timeout > 2592000: timeout = 0 return timeout
def _normalize_timeout(self, timeout): timeout = BaseCache._normalize_timeout(self, timeout) if timeout == 0: timeout = -1 return timeout
def _normalize_timeout(self, timeout): timeout = BaseCache._normalize_timeout(self, timeout) if timeout != 0: timeout = time() + timeout return int(timeout)
def _normalize_timeout(self, timeout): timeout = BaseCache._normalize_timeout(self, timeout) if timeout > 0: timeout = int(time()) + timeout return timeout
def _normalize_timeout(self, timeout): timeout = BaseCache._normalize_timeout(self, timeout) if timeout > 0: timeout = time() + timeout return timeout