Python django.core.cache.cache.delete_many() Examples
The following are 14
code examples of django.core.cache.cache.delete_many().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.core.cache.cache
, or try the search function
.
Example #1
Source File: signals.py From online-judge with GNU Affero General Public License v3.0 | 6 votes |
def problem_update(sender, instance, **kwargs): if hasattr(instance, '_updating_stats_only'): return cache.delete_many([ make_template_fragment_key('submission_problem', (instance.id,)), make_template_fragment_key('problem_feed', (instance.id,)), 'problem_tls:%s' % instance.id, 'problem_mls:%s' % instance.id, ]) cache.delete_many([make_template_fragment_key('problem_html', (instance.id, engine, lang)) for lang, _ in settings.LANGUAGES for engine in EFFECTIVE_MATH_ENGINES]) cache.delete_many([make_template_fragment_key('problem_authors', (instance.id, lang)) for lang, _ in settings.LANGUAGES]) cache.delete_many(['generated-meta-problem:%s:%d' % (lang, instance.id) for lang, _ in settings.LANGUAGES]) for lang, _ in settings.LANGUAGES: unlink_if_exists(get_pdf_path('%s.%s.pdf' % (instance.code, lang)))
Example #2
Source File: signals.py From online-judge with GNU Affero General Public License v3.0 | 5 votes |
def profile_update(sender, instance, **kwargs): if hasattr(instance, '_updating_stats_only'): return cache.delete_many([make_template_fragment_key('user_about', (instance.id, engine)) for engine in EFFECTIVE_MATH_ENGINES] + [make_template_fragment_key('org_member_count', (org_id,)) for org_id in instance.organizations.values_list('id', flat=True)])
Example #3
Source File: signals.py From online-judge with GNU Affero General Public License v3.0 | 5 votes |
def contest_update(sender, instance, **kwargs): if hasattr(instance, '_updating_stats_only'): return cache.delete_many(['generated-meta-contest:%d' % instance.id] + [make_template_fragment_key('contest_html', (instance.id, engine)) for engine in EFFECTIVE_MATH_ENGINES])
Example #4
Source File: signals.py From online-judge with GNU Affero General Public License v3.0 | 5 votes |
def language_update(sender, instance, **kwargs): cache.delete_many([make_template_fragment_key('language_html', (instance.id,)), 'lang:cn_map'])
Example #5
Source File: signals.py From online-judge with GNU Affero General Public License v3.0 | 5 votes |
def post_update(sender, instance, **kwargs): cache.delete_many([ make_template_fragment_key('post_summary', (instance.id,)), 'blog_slug:%d' % instance.id, 'blog_feed:%d' % instance.id, ]) cache.delete_many([make_template_fragment_key('post_content', (instance.id, engine)) for engine in EFFECTIVE_MATH_ENGINES])
Example #6
Source File: signals.py From online-judge with GNU Affero General Public License v3.0 | 5 votes |
def misc_config_cache_delete(key): cache.delete_many(['misc_config:%s:%s:%s' % (domain, lang, key.split('.')[0]) for lang in _misc_config_i18n for domain in Site.objects.values_list('domain', flat=True)])
Example #7
Source File: caching.py From online-judge with GNU Affero General Public License v3.0 | 5 votes |
def finished_submission(sub): keys = ['user_complete:%d' % sub.user_id, 'user_attempted:%s' % sub.user_id] if hasattr(sub, 'contest'): participation = sub.contest.participation keys += ['contest_complete:%d' % participation.id] keys += ['contest_attempted:%d' % participation.id] cache.delete_many(keys)
Example #8
Source File: models.py From developer-portal with Mozilla Public License 2.0 | 5 votes |
def save(self, *args, **kwargs): super().save(*args, **kwargs) cache.delete_many(self._bulk_invalidation_cache_keys)
Example #9
Source File: test_cache.py From django-mysql with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_delete_many(self): # Multiple keys can be deleted using delete_many cache.set("key1", "spam") cache.set("key2", "eggs") cache.set("key3", "ham") with self.assertNumQueries(1): cache.delete_many(["key1", "key2"]) assert cache.get("key1") is None assert cache.get("key2") is None assert cache.get("key3") == "ham"
Example #10
Source File: permissions.py From edx-analytics-dashboard with GNU Affero General Public License v3.0 | 5 votes |
def revoke_user_course_permissions(user): """ Revokes all course permissions for the given user. Arguments user (User) -- User for which permissions should be revoked """ cache.delete_many(_get_course_permission_cache_keys(user))
Example #11
Source File: models.py From protwis with Apache License 2.0 | 5 votes |
def invalidate_schematics(self): cache.delete_many([self.name + "_cons_schematic",self.name + "_wt_schematic",self.name + "_chem_summary"]) self.schematics = None self.save()
Example #12
Source File: models.py From djangocms-instagram with BSD 3-Clause "New" or "Revised" License | 5 votes |
def save(self, *args, **kwargs): super(Instagram, self).save(*args, **kwargs) cache_keys = ( self.get_cache_key(prefix='profile_%s' % self.user_id.strip()), self.get_cache_key(prefix='profile_%s' % self.account.uid), self.get_cache_key(prefix='location_%s' % self.location_id.strip()), self.get_cache_key(prefix='media'), ) cache.delete_many(cache_keys)
Example #13
Source File: decorators.py From django-admin-easy with MIT License | 5 votes |
def clear_cache(model): cache_object_key = helper.cache_object_key(model) obj_methods_caches = django_cache.get(cache_object_key) methods_key = obj_methods_caches.split('|') django_cache.delete_many(methods_key)
Example #14
Source File: caching.py From feedsubs with MIT License | 5 votes |
def remove_cleaned_articles(articles): cache.delete_many([cache_id_to_key(a.id) for a in articles])