Ejemplo n.º 1
0
    async def reset_cache(self, *args, new_value=None, **kwargs):
        """
        >>> @cached()
        >>> def somefunction(arg):
        >>>     pass
        >>>
        >>> [...]
        >>> arg = ... # same thing ^^
        >>> await somefunction.reset_cache(arg, new_value='Something')

        :param new_value: new/ updated value to be set [optional]
        """

        key = self.__build_key(*args, **kwargs)
        if new_value:
            return set_value(key, new_value, ttl=self.ttl)
        return bredis.delete(key)
Ejemplo n.º 2
0
 def reset_flood(self, message):
     return bredis.delete(self.cache_key(message))