def get_outside_cache(): """ the purpose of this tasks is to recycle the data from the cache with version=2 in the main cache """ all_packages = MyService.all_packages() for package in all_packages: cache = caches[package] # http://niwinz.github.io/django-redis/latest/#_scan_delete_keys_in_bulk for service in cache.iter_keys('th_*'): try: cache.get(service, version=2) except ValueError: pass
def recycle(): """ the purpose of this tasks is to recycle the data from the cache with version=2 in the main cache """ all_packages = MyService.all_packages() for package in all_packages: cache = caches[package] # http://niwinz.github.io/django-redis/latest/#_scan_delete_keys_in_bulk for service in cache.iter_keys('th_*'): try: # get the value from the cache version=2 service_value = cache.get(service, version=2) # put it in the version=1 cache.set(service, service_value) # remote version=2 cache.delete_pattern(service, version=2) except ValueError: pass logger.info('recycle of cache done!')
def get_outside_cache(result=''): """ the purpose of this tasks is to recycle the data from the cache with version=2 in the main cache :param result: the result of the previous tasks when cascading all of them :type result: string """ all_packages = MyService.all_packages() for package in all_packages: cache = caches[package] # http://niwinz.github.io/django-redis/latest/#_scan_delete_keys_in_bulk for service in cache.iter_keys('th_*'): try: # get the value from the cache version=2 service_value = cache.get(service, version=2) # put it in the version=1 cache.set(service, service_value) # remote version=2 cache.delete_pattern(service, version=2) except ValueError: pass
def get_outside_cache(result=''): """ the purpose of this tasks is to recycle the data from the cache with version=2 in the main cache :param result: the result of the previous tasks when cascading all of them :type result: string """ all_packages = MyService.all_packages() for package in all_packages: cache = caches[package] # http://niwinz.github.io/django-redis/latest/#_scan_delete_keys_in_bulk for service in cache.iter_keys('th_*'): try: # get the value from the cache version=2 service_value = cache.get(service, version=2) # put it in the version=1 cache.set(service, service_value) # remote version=2 cache.delete_pattern(service, version=2) except ValueError: pass
def recycle(): """ the purpose of this tasks is to recycle the data from the cache with version=2 in the main cache """ logger = getLogger('django_th.trigger_happy') all_packages = MyService.all_packages() for package in all_packages: if package in settings.DJANGO_TH.get('services_wo_cache'): continue cache = caches['django_th'] # http://niwinz.github.io/django-redis/latest/#_scan_delete_keys_in_bulk for service in cache.iter_keys('th_*'): try: # get the value from the cache version=2 service_value = cache.get(service, version=2) # put it in the version=1 cache.set(service, service_value) # remote version=2 cache.delete_pattern(service, version=2) except ValueError: pass logger.info('recycle of cache done!')
def test_all_packages(self): all_packages = MyService.all_packages() self.assertIsInstance(all_packages, list)