python - 如何调用缓存清除类方法?
问题描述
我有这个代码:
class Test(CqlEngineModel):
@classmethod
@cql_engine_connector
@functools.lru_cache(maxsize=1000)
def is_not_analyzable(cls, x, y):
if mic:
query_result = ...
mic_list = cls._to_list(query_result)
return True if mic_list else False
else:
return False
在外面我需要调用 cache_clear 函数,如下所示:
Test.is_not_analyzable.cache_clear()
但我有这个错误:
AttributeError: 'function' object has no attribute 'cache_clear
解决方案
推荐阅读
- node.js - 延迟执行异步函数数组,节点js
- flutter - 从 Firebase 加载数据缓慢导致“RangeError(索引)”
- linux - PHP在root用户而不是www-data上运行
- avaloniaui - Avalonia - 如何像 OneNote 桌面 UI 一样垂直放置 Tab 控件的选项卡
- winforms - 在文本框中书写时如何按 Enter?
- python-3.x - boto3 python启动EC2
- sql - 从列中查找指定值
- mysql - 通过 SSH 调用 Bash 时展开 here-document 中的选定变量
- postgresql - 从 Windows 10 主机连接安装在 WSL2 Ubuntu 中的 PostgreSQL 时出现问题
- r - for循环:选择在R中使用特定单词超过x次的用户