Exemple #1
0
    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
Exemple #2
0
    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
Exemple #3
0
    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
Exemple #4
0
 def clean_cache(self):
     oa_cache.clean()
Exemple #5
0
 def clean_cache(self):
     oa_cache.clean()
Exemple #6
0
    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