password
查看人数
type
status
date
slug
summary
category
icon
tags
作者
状态
在fastapi中有一个self.state:
notion image
看到Stats类中的备注是:
"""An object that can be used to store arbitrary state.Used for request.state and app.state.""" #可用于存储任意状态的对象。用于请求。State和app.state。
 
Stats类提供的方法有setattr,getattr,delattr对应的就是增加,获取,删除
notion image
 
那么我们就可以用这些方法进行临时数据存储,充当缓存使用。
使用
notion image
💡
有关使用上的问题,欢迎您在底部评论区留言,一起交流~
 
 
git 常用命令outlook获取最新的邮件内容
Loading...