{"id":21722,"library":"py-memoize","title":"py-memoize","description":"A caching library for asynchronous Python applications (asyncio-based) that handles dogpiling properly and provides a configurable & extensible API. Current version 3.1.1. Release cadence is irregular.","status":"active","version":"3.1.1","language":"python","source_language":"en","source_url":"https://github.com/DreamLab/memoize","tags":["cache","async","asyncio","memoization","dogpiling"],"install":[{"cmd":"pip install py-memoize","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from memoize import Memoizer","symbol":"Memoizer","correct":"import memoize"}],"quickstart":{"code":"import asyncio\nfrom memoize import Memoizer\nfrom memoize.cache import InMemoryCache, ExpiringCache\n\nmemoizer = Memoizer(cache=InMemoryCache())\n\n@memoizer.cache(ttl=5)\nasync def fetch_data(key: str) -> str:\n    await asyncio.sleep(1)\n    return f\"data-{key}\"\n\nasync def main():\n    result = await fetch_data(\"my_key\")\n    print(result)\n\nasyncio.run(main())","lang":"python","description":"Basic usage: create a Memoizer with an in-memory cache and decorate an async function with ttl in seconds."},"warnings":[{"fix":"Use asyncio-based applications or pin version to <3.0.0.","message":"Version 3.0.0 removed support for Tornado. If you rely on Tornado integration, stay on v2.x.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Update any exception handling logic that relied on checking exception.args for chained exceptions.","message":"Version 2.0.0 changed exception handling: exceptions are now chained (via __cause__) instead of being added to args. Timeout errors are now also chained.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Explicitly instantiate Memoizer with an ExpiringCache instance and configure ttl in the decorator.","message":"The default cache is InMemoryCache which has no expiration by default. Use ExpiringCache if you need TTL-based expiry.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the decorated function is defined with async def.","message":"The decorator requires the wrapped function to be async. Applying it to a sync function will cause a runtime error.","severity":"gotcha","affected_versions":"all"},{"fix":"Migrate to asyncio-based usage.","message":"Tornado support was deprecated in v1.2.0 and removed in v3.0.0. Tornado-specific imports will raise ImportError.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'3.1.1':26 'api':23 'applic':10 'async':32 'asynchron':8 'asyncio':12,33 'asyncio-bas':11 'base':13 'cach':5,31 'cadenc':28 'configur':21 'current':24 'dogpil':16,35 'extens':22 'handl':15 'irregular':30 'librari':6 'memoiz':3,34 'proper':17 'provid':19 'py':2 'py-memo':1 'python':9 'releas':27 'version':25","created_at":"2026-04-27T17:01:24.241893+00:00","updated_at":"2026-04-27T17:01:24.241893+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.1.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/DreamLab/memoize","docs":null,"changelog":null,"pypi":"https://pypi.org/project/py-memoize/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}