fastapi_cache:简单缓存FastAPI

时间:2021-05-06 19:05:27
【文件属性】:
文件名称:fastapi_cache:简单缓存FastAPI
文件大小:14KB
文件格式:ZIP
更新时间:2021-05-06 19:05:27
python redis cache pyton3 fastapi FastAPI缓存 将简单的轻量级缓存系统实现为FastAPI中的依赖项。 安装 pip install fastapi-cache 用法示例 from fastapi import Depends , FastAPI from fastapi_cache import caches , close_caches from fastapi_cache . backends . redis import CACHE_KEY , RedisCacheBackend app = FastAPI () def redis_cache (): return caches . get ( CACHE_KEY ) @ app . get ( '/' ) async def hello ( cache : RedisCacheBackend = Depends ( redis_cache
【文件预览】:
fastapi_cache-master
----setup.py(667B)
----.gitignore(2KB)
----requirements.txt(1B)
----fastapi_cache()
--------__init__.py(147B)
--------backends()
--------version.py(111B)
--------registry.py(870B)
----.travis.yml(220B)
----LICENSE(1KB)
----requirements-test.txt(56B)
----README.md(2KB)
----tests()
--------redis_tests.py(4KB)
--------__init__.py(0B)
--------ttldict_tests.py(4KB)
--------registry_tests.py(2KB)
--------memory_tests.py(4KB)
----pytest.ini(91B)
----tox.ini(228B)

网友评论