将cachetools与异步函数一起使用的帮助程序
asyncache的Python项目详细描述
使用异步缓存工具的帮助程序。
示例
fromasyncacheimportcachedfromcachetoolsimportTTLCachepool=...@cached(TTLCache(1024,60))asyncdefget_username(user_id):rec=awaitpool.fetchrow(""" SELECT username FROM users WHERE id = $1 """,user_id,)returnrecandrec["username"]
许可证
这个项目是在麻省理工学院的许可下授权的-请参阅LICENSE文件了解详细信息。