---
title: "asyncache | pypx"
description: "Helpers to use cachetools with async code."
canonical_url: "https://pypx.app/packages/asyncache"
meta:
  "og:description": "Helpers to use cachetools with async code."
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_asyncache%2Cversion_0.3.1%2Csummary_Helpers%2Bto%2Buse%2Bcachetools%2Bwith%2Basync%2Bcode.%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9hc3luY2FjaGUi%2Cs_tLBkF2caM_F6wGW5.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "asyncache 0.3.1"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_asyncache%2Cversion_0.3.1%2Csummary_Helpers%2Bto%2Buse%2Bcachetools%2Bwith%2Basync%2Bcode.%2Clicense_MIT%2BLicense%2Cp_Ii9wYWNrYWdlcy9hc3luY2FjaGUi%2Cs_tLBkF2caM_F6wGW5.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **asyncache**

v0.3.1

Helpers to use cachetools with async code.

4 KB Python 3.8+ py3-none-anyMIT License1 deps Likely Unmaintained

[** Diff **](https://pypx.app/packages/asyncache/diff)

`$ uv add asyncache`

##### asyncache

Helpers to use cachetools with asyncio.

![Latest PyPI version](https://img.shields.io/pypi/v/asyncache)

# Installation

asyncache is available from PyPI\_ and can be installed by running:

```
pip install asyncache
```

# Example

```python
from asyncache import cached
from cachetools import TTLCache

pool = ...

@cached(TTLCache(1024, 60))
async def get_username(user_id):
    rec = await pool.fetchrow(
        """
        SELECT
            username
        FROM
            users
        WHERE
            id = $1
        """,
        user_id,
    )
    return rec and rec["username"]
```

# License

This project is licensed under the MIT License - see the LICENSE\_ file for details.

# Acknowledgments

- `cachetools`\_

## **Details **

<dl>

<dt>Version</dt>
<dd>0.3.1</dd>

<dt>License</dt>
<dd>MIT License</dd>

<dt>Python</dt>
<dd>&gt;=3.8,&lt;4.0</dd>

<dt>Maintainer</dt>
<dd>hephex</dd>

</dl>

## **Links**

- [View on PyPI](https://pypi.org/project/asyncache/)

## **Maintainers **

- hephex · [figus.federico@gmail.com](mailto:figus.federico@gmail.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/asyncache#webpage","@type":"WebPage","description":"Helpers to use cachetools with async code.","name":"asyncache","url":"https://pypx.app/packages/asyncache","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/asyncache"]}]},{"@id":"https://pypx.app/packages/asyncache#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Helpers to use cachetools with async code.","license":"MIT License","name":"asyncache","softwareVersion":"0.3.1"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
