key_prefix
吗?@cache.cached(timeout=50, key_prefix='all_comments')
def get_all_comments():
comments = do_serious_dbio()
return [x.author for x in comments]
cached_comments = get_all_comments()
在文档中,它说
key_prefix
的默认值为request.path cache_key.
,那么cache_key
是什么意思,我该如何使用它?key_prefix
有什么作用?
if callable(key_prefix): cache_key = key_prefix()
。 - bool.dev