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


Python cache.delete_memoized函数代码示例

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


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


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