def __init__(self, redis_conn=None, debug=False,
                 with_lock=False, fail_gracefully=False):
        self.request = current.request
        self.debug = debug
        self.with_lock = with_lock
        self.fail_gracefully = fail_gracefully
        self.prefix = "w2p:cache:%s:" % self.request.application
        if self.request:
            app = self.request.application
        else:
            app = ''

        if app not in self.meta_storage:
            self.storage = self.meta_storage[app] = {
                CacheAbstract.cache_stats_name: {
                    'hit_total': 0,
                    'misses': 0,
                }}
        else:
            self.storage = self.meta_storage[app]

        self.cache_set_key = 'w2p:%s:___cache_set' % self.request.application

        self.r_server = redis_conn
        self._release_script = register_release_lock(self.r_server)
Esempio n. 2
0
 def __init__(self, redis_conn, session_expiry=False, with_lock=False):
     self.r_server = redis_conn
     self._release_script = register_release_lock(self.r_server)
     self.tablename = None
     self.session_expiry = session_expiry
     self.with_lock = with_lock
Esempio n. 3
0
 def __init__(self, redis_conn, session_expiry=False, with_lock=False):
     self.r_server = redis_conn
     self._release_script = register_release_lock(self.r_server)
     self.tablename = None
     self.session_expiry = session_expiry
     self.with_lock = with_lock