Exemplo n.º 1
0
    def __init__(self, host='localhost', port=6379, password=None,
                 default_timeout=300, key_prefix=None, debug=False):
        BaseCache.__init__(self, default_timeout, debug)

        if isinstance(host, basestring):
            try:
                import redis
            except ImportError:
                raise RuntimeError('no redis module found')
            self._client = redis.StrictRedis(host=host, port=port, password=password)
        else:
            self._client = host
        self.key_prefix = key_prefix or ''
Exemplo n.º 2
0
 def __init__(self, threshold=5000, default_timeout=300, debug=False):
     BaseCache.__init__(self, default_timeout)
     self._cache = {}
     self.clear = self._cache.clear
     self._threshold = threshold