https://github.com/ma-pony/asyncio-ttl-cache
async ttl cache
https://github.com/ma-pony/asyncio-ttl-cache
asyncio cache python3 ttl-cache
Last synced: over 1 year ago
JSON representation
async ttl cache
- Host: GitHub
- URL: https://github.com/ma-pony/asyncio-ttl-cache
- Owner: ma-pony
- Created: 2022-06-24T16:53:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-27T19:37:19.000Z (almost 4 years ago)
- Last Synced: 2025-02-04T12:02:40.831Z (over 1 year ago)
- Topics: asyncio, cache, python3, ttl-cache
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
一个异步函数的带有 ttl 缓存功能的装饰器
## Install
```shell
pip install asyncio-ttl-cache
```
## Example
```python
import asyncio
from asyncio_ttl_cache import ttl_cache
@ttl_cache(ttl=3)
async def sum(a: int, b: int) -> int:
await asyncio.sleep(1)
return a + b
if __name__ == '__main__':
asyncio.run(sum(1, 2))
```