Esempio n. 1
0
 def __init__(self, cache_dir, threshold=500, default_timeout=300, mode=0o600):
     BaseCache.__init__(self, default_timeout)
     self._path = cache_dir
     self._threshold = threshold
     self._mode = mode
     if not os.path.exists(self._path):
         os.makedirs(self._path)
Esempio n. 2
0
	def __init__(self, threshold=500, default_timeout=300):
		BaseCache.__init__(self, default_timeout=default_timeout)
		self._mutex = threading.RLock()
		self._cache = {}
		self._bypassed = set()
		self.clear = self._cache.clear
		self._threshold = threshold
Esempio n. 3
0
	def __init__(self, threshold=500, default_timeout=300):
		BaseCache.__init__(self, default_timeout=default_timeout)
		self._mutex = threading.RLock()
		self._cache = {}
		self._bypassed = set()
		self.clear = self._cache.clear
		self._threshold = threshold
Esempio n. 4
0
    def __init__(self, **kwargs):
        import pylibmc

        servers = kwargs.pop('servers', ['127.0.0.1:11211'])
        default_timeout = kwargs.pop('default_timeout', 300)
        key_prefix = kwargs.pop('key_prefix', None)
        BaseCache.__init__(self, default_timeout)

        self._client = pylibmc.Client(servers, binary=True, **kwargs)
        self.key_prefix = key_prefix
Esempio n. 5
0
    def __init__(self, servers=None, default_timeout=300, key_prefix=None,
                 username=None, password=None):
        BaseCache.__init__(self, default_timeout)

        if servers is None:
            servers = ['127.0.0.1:11211']

        import bmemcached
        self._client = bmemcached.Client(servers, username, password)

        self.key_prefix = key_prefix
Esempio n. 6
0
    def __init__(self, servers=None, default_timeout=300, key_prefix=None, username=None, password=None):
        BaseCache.__init__(self, default_timeout)

        if servers is None:
            servers = ["127.0.0.1:11211"]

        import pylibmc

        self._client = pylibmc.Client(servers, username=username, password=password, binary=True)

        self.key_prefix = key_prefix
Esempio n. 7
0
    def __init__(self, host="127.0.0.1", port=9090, prefix=None, table_name=None, default_timeout=300, **kwargs):
        # Potential bug: table_prefix instead of prefix
        BaseCache.__init__(self, default_timeout)

        if not table_name:
            raise TypeError("table_name is a required argument")
        self.table_name = table_name

        self._c = Connection(host=host, port=port, table_prefix=prefix, **kwargs)
        self._table = self._c.table(table_name)  # Note: initialisation overwrites the existing rows of the Hbase table

        self.clear()
Esempio n. 8
0
    def __init__(self, servers=None, default_timeout=300, key_prefix=None,
                 username=None, password=None):
        BaseCache.__init__(self, default_timeout)

        if servers is None:
            servers = ['127.0.0.1:11211']

        import pylibmc
        self._client = pylibmc.Client(servers,
                                      username=username,
                                      password=password,
                                      binary=True)

        self.key_prefix = key_prefix
 def __init__(self, host='localhost', port=6379, password=None,
              default_timeout=300, key_prefix=None, **kwargs):
     BaseCache.__init__(self, default_timeout)
     if isinstance(host, string_types):
         try:
             from rediscluster import StrictRedisCluster
         except ImportError:
             raise RuntimeError('no redis cluster module found')
         if kwargs.get('decode_responses', None):
             raise ValueError('decode_responses is not supported by '
                              'RedisClusterCache.')
         self._client = StrictRedisCluster(host=host,
                                           port=port,
                                           password=password,
                                           **kwargs)
     else:
         self._client = host
     self.key_prefix = key_prefix or ''
Esempio n. 10
0
    def __init__(self,
                 table_name,
                 access_key_id=None,
                 secret_access_key=None,
                 aws_region=None,
                 endpoint_url=None,
                 default_timeout=300,
                 read_capacity_units=1,
                 write_capacity_units=1,
                 **kwargs):

        BaseCache.__init__(self, default_timeout)

        self.table_name = table_name
        self.access_key_id = access_key_id
        self.secret_access_key = secret_access_key
        self.aws_region = aws_region
        self.endpoint_url = endpoint_url
        self.default_timeout = default_timeout
        self.read_capacity_units = read_capacity_units
        self.write_capacity_units = write_capacity_units
        self._client = None
Esempio n. 11
0
 def __init__(self,
              host='localhost',
              port=6379,
              default_timeout=300,
              key_prefix=None,
              startup_nodes=[{
                  "host": "127.0.0.1",
                  "port": "6379"
              }],
              **kwargs):
     BaseCache.__init__(self, default_timeout)
     if isinstance(host, string_types):
         try:
             from rediscluster import RedisCluster
         except ImportError:
             raise RuntimeError('no redis cluster module found')
         if kwargs.get('decode_responses', None):
             raise ValueError('decode_responses is not supported by '
                              'RedisClusterCache.')
         self._client = RedisCluster(startup_nodes=startup_nodes, **kwargs)
     else:
         self._client = host
     self.key_prefix = key_prefix or ''
Esempio n. 12
0
 def __init__(self, threshold=500, default_timeout=300, pickle=True):
     BaseCache.__init__(self, default_timeout)
     self._cache = {}
     self._threshold = threshold
     self._pickle = pickle
     self._lock = RWLock()
Esempio n. 13
0
	def __init__(self, threshold=500, default_timeout=300):
		BaseCache.__init__(self, default_timeout=default_timeout)
		self._cache = {}
		self.clear = self._cache.clear
		self._threshold = threshold
Esempio n. 14
0
 def __init__(self, default_timeout=300, max_entries=300, maxcull=10):
     BaseCache.__init__(self, default_timeout)
     self.max_entries = max_entries
     self.maxcull = maxcull
Esempio n. 15
0
 def __init__(self, timeout=300):
     BaseCache.__init__(self, timeout)
     self._client = memcache.Client()
Esempio n. 16
0
 def __init__(self, threshold=500, default_timeout=300):
     BaseCache.__init__(self, default_timeout=default_timeout)
     self._cache = {}
     self.clear = self._cache.clear
     self._threshold = threshold
Esempio n. 17
0
 def __init__(self, default_timeout=300, max_entries=300, maxcull=10):
     BaseCache.__init__(self, default_timeout)
     self.max_entries = max_entries
     self.maxcull = maxcull
Esempio n. 18
0
 def __init__(self, default_timeout=500):
     BaseCache.__init__(self, default_timeout)
     self.key_prefix = CENDR_VERSION
Esempio n. 19
0
 def __init__(self, default_timeout=DEFAULT_TIMEOUT, coll_name=None):
     BaseCache.__init__(self, default_timeout)
     coll_name = coll_name or self.__class__.__name__
     self.coll = get_connection()[coll_name]