本文整理汇总了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)
示例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)
示例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)
示例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'
示例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!'
示例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!'
示例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
示例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)
示例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)
示例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)
示例11: delete_last_activity
def delete_last_activity(app_id):
"""Reset last_activity value in cache"""
delete_memoized(last_activity, app_id)
示例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)
示例13: delete_app
def delete_app(short_name):
"""Reset app values in cache"""
delete_memoized(get_app, short_name)
示例14: delete_last_activity
def delete_last_activity(project_id):
"""Reset last_activity value in cache"""
delete_memoized(last_activity, project_id)
示例15: delete_user_pref_metadata
def delete_user_pref_metadata(name):
delete_memoized(get_user_pref_metadata, name)