Skip to main content

Decorator to cache async function results

Project description

Caching decorator for async functions

This is a replacement for @cached() decorator from cachetools. cachetools does not support async at the time of writing.

Installation

    pip install async-cached

Example

    from cachetools import LRUCache
    from asynccached import asynccached

    
    _cache = LRUCache(maxsize=1)


    @asynccached(cache=_cache, key=lambda arg: arg)
    async def func(arg):
        pass

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async-cached-3.11.2.tar.gz (1.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page