Beispiel #1
0
def invalidate_jinja2_cache(sender, collection=None, lang=None, **extra):
    """
    Invalidate collection cache
    """
    from invenio.ext.cache import cache
    if lang is None:
        lang = current_app.config['CFG_SITE_LANG']
    cache.delete(make_template_fragment_key(collection.name, vary_on=[lang]))
Beispiel #2
0
def invalidate_jinja2_cache(sender, collection=None, lang=None, **extra):
    """
    Invalidate collection cache
    """
    from invenio.ext.cache import cache
    if lang is None:
        lang = current_app.config['CFG_SITE_LANG']
    cache.delete(make_template_fragment_key(collection.name, vary_on=[lang]))
Beispiel #3
0
def remove_session(user_id):
    """Remove session for a user."""
    prefix = cache.cache.key_prefix + "session::"

    for k in cache.cache._client.keys():
        if k.startswith(prefix):
            k = k[len(cache.cache.key_prefix):]
            try:
                data = Serializer.loads(cache.get(k))
                if data['uid'] == user_id:
                    print k
                    cache.delete(k)
            except TypeError:
                pass
Beispiel #4
0
 def delete_from_storage(self, sid):
     return cache.delete(self.generate_key(sid))
Beispiel #5
0
 def delete_from_storage(self, sid):
     return cache.delete(self.generate_key(sid))
Beispiel #6
0
 def drop(self):
     """See :meth:`~invenio.modules.jsonalchemy.storage.Storage.create`."""
     while self._keys:
         cache.delete(self._prefix + self._keys.pop())
Beispiel #7
0
 def drop(self):
     """See :meth:`~invenio.modules.jsonalchemy.storage.Storage.create`."""
     while self._keys:
         cache.delete(self._prefix + self._keys.pop())