Exemplo n.º 1
0
    def __init__(self, table, params):
        BaseCache.__init__(self, params)
        self._table = table

        class CacheEntry(object):
            _meta = Options(table)
        self.cache_model_class = CacheEntry
Exemplo n.º 2
0
 def test_cache_key_memcache_validation(self):
     """
     Handle cache key creation correctly, see #17861.
     """
     name = "/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/long filename/ with spaces Here and ?#%#$/other/stuff/some crazy/" + "\x16" + "\xb4"
     cache_key = storage.staticfiles_storage.cache_key(name)
     cache_validator = BaseCache({})
     cache_validator.validate_key(cache_key)
     self.assertEqual(cache_key, 'staticfiles:821ea71ef36f95b3922a77f7364670e7')
Exemplo n.º 3
0
 def __init__(self, name, params):
     BaseCache.__init__(self, params)
     global _caches, _expire_info, _locks
     self._cache = _caches.setdefault(name, {})
     self._expire_info = _expire_info.setdefault(name, {})
     self._lock = _locks.setdefault(name, RWLock())
Exemplo n.º 4
0
 def __init__(self, host, *args, **kwargs):
     BaseCache.__init__(self, *args, **kwargs)
Exemplo n.º 5
0
 def __init__(self, dir, params):
     BaseCache.__init__(self, params)
     self._dir = dir
     if not os.path.exists(self._dir):
         self._createdir()