def test_make_profile_cache_decorator(): cache.delete_memoized(TravelerProfile.make_traveler_profile) region = 'default' traveler_type = 'standard' traveler_profile_1 = TravelerProfile.make_traveler_profile(region, traveler_type) traveler_profile_2 = TravelerProfile.make_traveler_profile(region, traveler_type) assert traveler_profile_1 is traveler_profile_2
def _clear_cache(self): logging.getLogger(__name__).info('clear cache') try: cache.delete_memoized(self._all_keys_of_id) except RuntimeError: #if there is an error with cache, flask want to access to the app, this will fail at startup #with a "working outside of application context" logger = logging.getLogger(__name__) logger.exception('there seem to be some kind of problems with the cache')
def _clear_cache(self): logging.getLogger(__name__).info('clear cache') try: cache.delete_memoized(self._all_keys_of_id) except: # if there is an error with cache, flask want to access to the app, this will fail at startup # with a "working outside of application context" # redis timeout also raise an exception: redis.exceptions.TimeoutError # each backend has it's own exceptions, so we catch everything :( logger = logging.getLogger(__name__) logger.exception('there seem to be some kind of problems with the cache')
def _clear_cache(self): logging.info('clear cache') cache.delete_memoized(self._all_keys_of_id)
def _clear_cache(self): logging.getLogger(__name__).info('clear cache') cache.delete_memoized(self._all_keys_of_id)