An open API service indexing awesome lists of open source software.

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

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))

```