def delete_from_cache(self, full_url): key = self.cache_key(full_url) # COMMENT Matteo: exception here should be handled from # redis oa_cache.delete(key) return True
def save_in_cache(self, full_url, data): key = self.cache_key(full_url) oa_cache.set(key, { 'timestamp' : int(time.time()), 'data' : data }) return True
def get_from_cache(self, full_url): key = self.cache_key(full_url) cached_entry = oa_cache.get(key) rv = None if cached_entry: if self.cached_entry_is_valid(cached_entry): rv = cached_entry['data'] return rv
def clean_cache(self): oa_cache.clean()
def save_in_cache(self, full_url, data): key = self.cache_key(full_url) oa_cache.set(key, {'timestamp': int(time.time()), 'data': data}) return True