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

Uploaded Source

File details

Details for the file async-cached-3.11.2.tar.gz.

File metadata

  • Download URL: async-cached-3.11.2.tar.gz
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for async-cached-3.11.2.tar.gz
Algorithm Hash digest
SHA256 954adb57c19cf56621f3409c5e061a63f5033f496fd4108523d65be95431a50a
MD5 2901bbc824bce8ab1758823d0f653d78
BLAKE2b-256 24faca0ca4b0a7761a2e4272001f28d7b3d47cc79680a186e9fb9f2241112319

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page