def clear_data_consent_share_cache(user_id, course_id, enterprise_customer_uuid): """ clears data_sharing_consent_needed cache """ consent_cache_key = get_data_consent_share_cache_key( user_id, course_id, enterprise_customer_uuid) TieredCache.delete_all_tiers(consent_cache_key)
def invalidate_processor_cache(*_args, **kwargs): """ When Waffle switches for payment processors are toggled, the payment processor list view cache must be invalidated. """ switch = kwargs['instance'] parts = switch.name.split(settings.PAYMENT_PROCESSOR_SWITCH_PREFIX) if len(parts) == 2: processor = parts[1] logger.info('Switched payment processor [%s] %s.', processor, 'on' if switch.active else 'off') TieredCache.delete_all_tiers(PAYMENT_PROCESSOR_CACHE_KEY) logger.info('Invalidated payment processor cache after toggling [%s].', switch.name)
def delete_data_sharing_consent(course_id, customer_uuid, user_email): """ Delete the DSC records from the DB for given learner, course and customer, also its cache. """ # Deleting the DSC record. user = User.objects.get(email=user_email) enterprise_customer_user = get_enterprise_customer_user( user.id, customer_uuid) enterprise_customer_user.data_sharing_consent_records.filter( course_id=course_id).delete() # Deleting the DCS cache consent_cache_key = get_cache_key(type='data_sharing_consent_needed', user_id=user.id, course_id=course_id) TieredCache.delete_all_tiers(consent_cache_key)
def clear_data_consent_share_cache(user_id, course_id): """ clears data_sharing_consent_needed cache """ consent_cache_key = get_data_consent_share_cache_key(user_id, course_id) TieredCache.delete_all_tiers(consent_cache_key)
def invalidate(self, **kwargs): """ Invalidate all keys tracked by the manager. """ for key in self.keys: TieredCache.delete_all_tiers(key)