{"id":13442299,"url":"https://github.com/tkem/cachetools","last_synced_at":"2025-05-13T18:04:38.576Z","repository":{"id":15277401,"uuid":"18006791","full_name":"tkem/cachetools","owner":"tkem","description":"Extensible memoizing collections and decorators","archived":false,"fork":false,"pushed_at":"2025-05-06T11:32:34.000Z","size":407,"stargazers_count":2486,"open_issues_count":5,"forks_count":168,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-06T17:13:07.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkem.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["tkem"],"custom":["https://www.paypal.me/tkem"]}},"created_at":"2014-03-22T10:15:14.000Z","updated_at":"2025-05-05T15:32:50.000Z","dependencies_parsed_at":"2025-05-06T15:11:02.628Z","dependency_job_id":null,"html_url":"https://github.com/tkem/cachetools","commit_stats":{"total_commits":306,"total_committers":13,"mean_commits":23.53846153846154,"dds":"0.12091503267973858","last_synced_commit":"6c78a8ff67b21834c3873cc918d87b2c5cb22e5c"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkem%2Fcachetools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkem%2Fcachetools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkem%2Fcachetools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkem%2Fcachetools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkem","download_url":"https://codeload.github.com/tkem/cachetools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788532,"owners_count":21804284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:44.066Z","updated_at":"2025-05-13T18:04:38.540Z","avatar_url":"https://github.com/tkem.png","language":"Python","readme":"cachetools\n========================================================================\n\n.. image:: https://img.shields.io/pypi/v/cachetools\n   :target: https://pypi.org/project/cachetools/\n   :alt: Latest PyPI version\n\n.. image:: https://img.shields.io/github/actions/workflow/status/tkem/cachetools/ci.yml\n   :target: https://github.com/tkem/cachetools/actions/workflows/ci.yml\n   :alt: CI build status\n\n.. image:: https://img.shields.io/readthedocs/cachetools\n   :target: https://cachetools.readthedocs.io/\n   :alt: Documentation build status\n\n.. image:: https://img.shields.io/codecov/c/github/tkem/cachetools/master.svg\n   :target: https://codecov.io/gh/tkem/cachetools\n   :alt: Test coverage\n\n.. image:: https://img.shields.io/librariesio/sourcerank/pypi/cachetools\n   :target: https://libraries.io/pypi/cachetools\n   :alt: Libraries.io SourceRank\n\n.. image:: https://img.shields.io/github/license/tkem/cachetools\n   :target: https://raw.github.com/tkem/cachetools/master/LICENSE\n   :alt: License\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/psf/black\n   :alt: Code style: black\n\n\nThis module provides various memoizing collections and decorators,\nincluding variants of the Python Standard Library's `@lru_cache`_\nfunction decorator.\n\n.. code-block:: python\n\n   from cachetools import cached, LRUCache, TTLCache\n\n   # speed up calculating Fibonacci numbers with dynamic programming\n   @cached(cache={})\n   def fib(n):\n       return n if n \u003c 2 else fib(n - 1) + fib(n - 2)\n\n   # cache least recently used Python Enhancement Proposals\n   @cached(cache=LRUCache(maxsize=32))\n   def get_pep(num):\n       url = 'http://www.python.org/dev/peps/pep-%04d/' % num\n       with urllib.request.urlopen(url) as s:\n           return s.read()\n\n   # cache weather data for no longer than ten minutes\n   @cached(cache=TTLCache(maxsize=1024, ttl=600))\n   def get_weather(place):\n       return owm.weather_at_place(place).get_weather()\n\nFor the purpose of this module, a *cache* is a mutable_ mapping_ of a\nfixed maximum size.  When the cache is full, i.e. by adding another\nitem the cache would exceed its maximum size, the cache must choose\nwhich item(s) to discard based on a suitable `cache algorithm`_.\n\nThis module provides multiple cache classes based on different cache\nalgorithms, as well as decorators for easily memoizing function and\nmethod calls.\n\n\nInstallation\n------------------------------------------------------------------------\n\ncachetools is available from PyPI_ and can be installed by running::\n\n  pip install cachetools\n\nTyping stubs for this package are provided by typeshed_ and can be\ninstalled by running::\n\n  pip install types-cachetools\n\n\nProject Resources\n------------------------------------------------------------------------\n\n- `Documentation`_\n- `Issue tracker`_\n- `Source code`_\n- `Change log`_\n\n\nRelated Projects\n------------------------------------------------------------------------\n\n- asyncache_: Helpers to use cachetools with async functions\n- cacheing_: Pure Python Cacheing Library\n- CacheToolsUtils_: Cachetools Utilities\n- kids.cache_: Kids caching library\n- shelved-cache_: Persistent cache for Python cachetools\n\n\nLicense\n------------------------------------------------------------------------\n\nCopyright (c) 2014-2025 Thomas Kemmer.\n\nLicensed under the `MIT License`_.\n\n\n.. _@lru_cache: https://docs.python.org/3/library/functools.html#functools.lru_cache\n.. _mutable: https://docs.python.org/dev/glossary.html#term-mutable\n.. _mapping: https://docs.python.org/dev/glossary.html#term-mapping\n.. _cache algorithm: https://en.wikipedia.org/wiki/Cache_algorithms\n\n.. _PyPI: https://pypi.org/project/cachetools/\n.. _typeshed: https://github.com/python/typeshed/\n.. _Documentation: https://cachetools.readthedocs.io/\n.. _Issue tracker: https://github.com/tkem/cachetools/issues/\n.. _Source code: https://github.com/tkem/cachetools/\n.. _Change log: https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst\n.. _MIT License: https://raw.github.com/tkem/cachetools/master/LICENSE\n\n.. _asyncache: https://pypi.org/project/asyncache/\n.. _cacheing: https://github.com/breid48/cacheing\n.. _CacheToolsUtils: https://pypi.org/project/CacheToolsUtils/\n.. _kids.cache: https://pypi.org/project/kids.cache/\n.. _shelved-cache: https://pypi.org/project/shelved-cache/\n","funding_links":["https://github.com/sponsors/tkem","https://www.paypal.me/tkem"],"categories":["HarmonyOS","Python","Containers \u0026 Language Extentions \u0026 Linting","Python decorator in the wild","Data Caching","Caching"],"sub_categories":["Windows Manager","For Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkem%2Fcachetools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkem%2Fcachetools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkem%2Fcachetools/lists"}