Пример #1
0
    def get_cache_record(self, **kwargs):
        locator = kwargs
        locator['layers'] = ','.join(locator['layers'])
        locator['time'] = locator['time'].strftime("%Y%m%d%H") if 'time' in locator and locator['time'] else query.today() + timedelta(hours=datetime.now().hour)
        if 'fresh' in locator:
            del locator['fresh']


        return self.cache.locate(**locator)
Пример #2
0
    def cache_result(self, item, **kwargs):
        locator = kwargs
        locator['layers'] = ','.join(locator['layers'])
        locator['time'] = locator['time'].strftime("%Y%m%d%H") if 'time' in locator and locator['time'] else query.today() + timedelta(hours=datetime.now().hour)
        if 'fresh' in locator:
            del locator['fresh']

        self.cache.save(item, **locator)