当前位置: 首页>>代码示例>>Python>>正文


Python cache.delete_many方法代码示例

本文整理汇总了Python中django.core.cache.cache.delete_many方法的典型用法代码示例。如果您正苦于以下问题:Python cache.delete_many方法的具体用法?Python cache.delete_many怎么用?Python cache.delete_many使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.core.cache.cache的用法示例。


在下文中一共展示了cache.delete_many方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: problem_update

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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))) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:19,代码来源:signals.py

示例2: profile_update

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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)]) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:10,代码来源:signals.py

示例3: contest_update

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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]) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:9,代码来源:signals.py

示例4: language_update

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
def language_update(sender, instance, **kwargs):
    cache.delete_many([make_template_fragment_key('language_html', (instance.id,)),
                       'lang:cn_map']) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:5,代码来源:signals.py

示例5: post_update

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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]) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:10,代码来源:signals.py

示例6: misc_config_cache_delete

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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)]) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:6,代码来源:signals.py

示例7: finished_submission

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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) 
开发者ID:DMOJ,项目名称:online-judge,代码行数:9,代码来源:caching.py

示例8: save

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        cache.delete_many(self._bulk_invalidation_cache_keys) 
开发者ID:mdn,项目名称:developer-portal,代码行数:5,代码来源:models.py

示例9: test_delete_many

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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" 
开发者ID:adamchainz,项目名称:django-mysql,代码行数:12,代码来源:test_cache.py

示例10: revoke_user_course_permissions

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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)) 
开发者ID:edx,项目名称:edx-analytics-dashboard,代码行数:10,代码来源:permissions.py

示例11: invalidate_schematics

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
def invalidate_schematics(self):
        cache.delete_many([self.name + "_cons_schematic",self.name + "_wt_schematic",self.name + "_chem_summary"])
        self.schematics = None
        self.save() 
开发者ID:protwis,项目名称:protwis,代码行数:6,代码来源:models.py

示例12: save

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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) 
开发者ID:mishbahr,项目名称:djangocms-instagram,代码行数:11,代码来源:models.py

示例13: clear_cache

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
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) 
开发者ID:ebertti,项目名称:django-admin-easy,代码行数:7,代码来源:decorators.py

示例14: remove_cleaned_articles

# 需要导入模块: from django.core.cache import cache [as 别名]
# 或者: from django.core.cache.cache import delete_many [as 别名]
def remove_cleaned_articles(articles):
    cache.delete_many([cache_id_to_key(a.id) for a in articles]) 
开发者ID:NicolasLM,项目名称:feedsubs,代码行数:4,代码来源:caching.py


注:本文中的django.core.cache.cache.delete_many方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。