• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cache.delete_memoized函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pybossa.cache.delete_memoized函数的典型用法代码示例。如果您正苦于以下问题:Python delete_memoized函数的具体用法?Python delete_memoized怎么用?Python delete_memoized使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: reset

def reset():
    """Clean the cache"""
    delete_cached("index_front_page")
    delete_cached('front_page_featured_apps')
    delete_cached('front_page_top_apps')
    delete_cached('number_featured_apps')
    delete_cached('number_published_apps')
    delete_cached('number_draft_apps')
    delete_memoized(get_published)
    delete_memoized(get_featured)
    delete_memoized(get_draft)
    delete_memoized(n_count)
    delete_memoized(get)
开发者ID:ferryville,项目名称:pybossa,代码行数:13,代码来源:apps.py


示例2: clean

def clean(app_id):
    """Clean all items in cache"""
    reset()
    delete_memoized(n_tasks, app_id)
    delete_memoized(n_task_runs, app_id)
    delete_memoized(last_activity, app_id)
    delete_memoized(overall_progress, app_id)
开发者ID:SkyTruth,项目名称:pybossa,代码行数:7,代码来源:apps.py


示例3: reset

def reset():
    """Clean the cache"""
    delete_cached("index_front_page")
    delete_cached("front_page_featured_projects")
    delete_cached("front_page_top_projects")
    delete_cached("number_featured_projects")
    delete_cached("number_published_projects")
    delete_cached("number_draft_projects")
    delete_memoized(get_all_featured)
    delete_memoized(get_all_draft)
    delete_memoized(n_count)
    delete_memoized(get_all)
开发者ID:seesmith,项目名称:pybossa,代码行数:12,代码来源:projects.py


示例4: test_delete_memoized_returns_false_when_delete_fails

    def test_delete_memoized_returns_false_when_delete_fails(self):
        """Test CACHE delete_memoized returns False if deletion is not successful"""

        @memoize()
        def my_func(*args, **kwargs):
            return [args, kwargs]
        my_func('arg', kwarg='kwarg')
        assert len(test_sentinel.master.keys()) == 1

        delete_succedeed = delete_memoized(my_func, 'badarg', kwarg='barkwarg')
        assert delete_succedeed is False, delete_succedeed
        assert len(test_sentinel.master.keys()) == 1, 'Key was unexpectedly deleted'
开发者ID:IdahoInstitute,项目名称:pybossa,代码行数:12,代码来源:__init__.py


示例5: test_delete_memoized_returns_true_when_delete_succeeds

    def test_delete_memoized_returns_true_when_delete_succeeds(self):
        """Test CACHE delete_memoized deletes a stored key and returns True if
        deletion is successful"""

        @memoize()
        def my_func(*args, **kwargs):
            return [args, kwargs]
        my_func('arg', kwarg='kwarg')
        assert len(test_sentinel.master.keys()) == 1

        delete_succedeed = delete_memoized(my_func, 'arg', kwarg='kwarg')
        assert delete_succedeed is True, delete_succedeed
        assert test_sentinel.master.keys() == [], 'Key was not deleted!'
开发者ID:IdahoInstitute,项目名称:pybossa,代码行数:13,代码来源:__init__.py


示例6: test_delete_memoized_deletes_only_requested

    def test_delete_memoized_deletes_only_requested(self):
        """Test CACHE delete_memoized deletes only the values it's asked and
        leaves the rest untouched"""

        @memoize()
        def my_func(*args, **kwargs):
            return [args, kwargs]
        my_func('arg', kwarg='kwarg')
        my_func('other', kwarg='other')
        assert len(test_sentinel.master.keys()) == 2

        delete_succedeed = delete_memoized(my_func, 'arg', kwarg='kwarg')
        assert delete_succedeed is True, delete_succedeed
        assert len(test_sentinel.master.keys()) == 1, 'Everything was deleted!'
开发者ID:IdahoInstitute,项目名称:pybossa,代码行数:14,代码来源:__init__.py


示例7: test_delete_memoized_deletes_all_function_calls

    def test_delete_memoized_deletes_all_function_calls(self):
        """Test CACHE delete_memoized deletes all the function calls stored if
        only function is specified and no arguments of the calls are provided"""

        @memoize()
        def my_func(*args, **kwargs):
            return [args, kwargs]
        @memoize()
        def my_other_func(*args, **kwargs):
            return [args, kwargs]
        my_func('arg', kwarg='kwarg')
        my_func('other', kwarg='other')
        my_other_func('arg', kwarg='kwarg')
        assert len(test_sentinel.master.keys()) == 3

        delete_succedeed = delete_memoized(my_func)
        assert delete_succedeed is True, delete_succedeed
        assert len(test_sentinel.master.keys()) == 1
开发者ID:IdahoInstitute,项目名称:pybossa,代码行数:18,代码来源:__init__.py


示例8: clean_project

def clean_project(project_id, category=None):
    """Clean cache for a specific project"""
    project = db.session.query(Project).get(project_id)
    delete_browse_tasks(project_id)
    delete_n_tasks(project_id)
    delete_n_completed_tasks(project_id)
    delete_n_results(project_id)
    delete_n_registered_volunteers(project_id)
    delete_n_anonymous_volunteers(project_id)
    delete_n_volunteers(project_id)
    delete_last_activity(project_id)
    delete_n_task_runs(project_id)
    delete_overall_progress(project_id)
    if project:
        delete_memoized(get_all, project.category.short_name)
        delete_memoized(n_count, project.category.short_name)
        delete_memoized(get_all_draft, None)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:17,代码来源:projects.py


示例9: delete_n_completed_tasks

def delete_n_completed_tasks(project_id):
    """Reset n_completed_tasks value in cache"""
    delete_memoized(n_completed_tasks, project_id)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:3,代码来源:projects.py


示例10: delete_user_summary_id

def delete_user_summary_id(oid):
    """Delete from cache the user summary."""
    user = db.session.query(User).get(oid)
    delete_memoized(get_user_summary, user.name)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:4,代码来源:users.py


示例11: delete_last_activity

def delete_last_activity(app_id):
    """Reset last_activity value in cache"""
    delete_memoized(last_activity, app_id)
开发者ID:bcfuchs,项目名称:pybossa,代码行数:3,代码来源:apps.py


示例12: delete_n_task_runs

def delete_n_task_runs(app_id):
    """Reset n_tasks value in cache"""
    delete_memoized(n_task_runs, app_id)
开发者ID:bcfuchs,项目名称:pybossa,代码行数:3,代码来源:apps.py


示例13: delete_app

def delete_app(short_name):
    """Reset app values in cache"""
    delete_memoized(get_app, short_name)
开发者ID:bcfuchs,项目名称:pybossa,代码行数:3,代码来源:apps.py


示例14: delete_last_activity

def delete_last_activity(project_id):
    """Reset last_activity value in cache"""
    delete_memoized(last_activity, project_id)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:3,代码来源:projects.py


示例15: delete_user_pref_metadata

def delete_user_pref_metadata(name):
    delete_memoized(get_user_pref_metadata, name)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:2,代码来源:users.py


示例16: delete_n_task_runs

def delete_n_task_runs(project_id):
    """Reset n_tasks value in cache"""
    delete_memoized(n_task_runs, project_id)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:3,代码来源:projects.py


示例17: delete_overall_progress

def delete_overall_progress(project_id):
    """Reset overall_progress value in cache"""
    delete_memoized(overall_progress, project_id)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:3,代码来源:projects.py


示例18: delete_project

def delete_project(short_name):
    """Reset project values in cache"""
    delete_memoized(get_project, short_name)
开发者ID:jonwusg,项目名称:pybossa,代码行数:3,代码来源:projects.py


示例19: delete_n_volunteers

def delete_n_volunteers(project_id):
    """Reset n_volunteers value in cache"""
    delete_memoized(n_volunteers, project_id)
开发者ID:influencerplus123,项目名称:tinybee.ai,代码行数:3,代码来源:projects.py


示例20: delete_team_summary

def delete_team_summary():
    """Delete from cache the team summary."""
    delete_memoized(get_teams_count)
    delete_memoized(get_teams_page)
开发者ID:chispita,项目名称:pybossa,代码行数:4,代码来源:teams.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python categories.get_all函数代码示例发布时间:2022-05-25
下一篇:
Python auth.ensure_authorized_to函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap