@classmethod
    def invalidate(cls, region):
        """Invalidate an entire region

        .. note::

            This does not actually *clear* the region of data, but
            just sets the value to expire on next access.

        :param region: Region name
        :type region: string

        """
        redis = global_connection.redis
        namespaces = redis.smembers('retools:%s:namespaces' % region)
        if not namespaces:
            return None

        # Locate the longest expiration of a region, so we can set
        # the created value far enough back to force a refresh
        longest_expire = max(
              [x['expires'] for x in CacheRegion.regions.values()])
        new_created = time.time() - longest_expire - 3600

        for ns in namespaces:
            cache_keyset_key = 'retools:%s:%s:keys' % (region, ns)
            keys = set(['']) | redis.smembers(cache_keyset_key)
            for key in keys:
                cache_key = 'retools:%s:%s:%s' % (region, ns, key)
                if not redis.exists(cache_key):
                    redis.srem(cache_keyset_key, key)
                else:
                    redis.hset(cache_key, 'created', new_created)
dataset/ETHPy150Open bbangert/retools/retools/cache.py/CacheRegion.invalidate/original