1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
3 NAMEBASE= python-cachetools
7 SDESC[py37]= Extensible memoizing collections (PY37)
8 SDESC[py38]= Extensible memoizing collections (PY38)
9 HOMEPAGE= https://github.com/tkem/cachetools/
10 CONTACT= Python_Automaton[python@ironwolf.systems]
13 SITES[main]= PYPI/c/cachetools
14 DISTFILE[1]= cachetools-4.1.0.tar.gz:main
19 OPTIONS_AVAILABLE= PY38 PY37
20 OPTIONS_STANDARD= none
21 VOPTS[py37]= PY38=OFF PY37=ON
22 VOPTS[py38]= PY38=ON PY37=OFF
24 DISTNAME= cachetools-4.1.0
28 [PY37].USES_ON= python:py37
30 [PY38].USES_ON= python:py38
32 [FILE:2946:descriptions/desc.single]
34 ========================================================================
36 :alt: Latest PyPI version
38 :alt: Documentation build status
40 :alt: Travis CI build status
46 This module provides various memoizing collections and decorators,
47 including variants of the Python Standard Library's `@lru_cache`_
50 .. code-block:: python
52 from cachetools import cached, LRUCache, TTLCache
54 # speed up calculating Fibonacci numbers with dynamic programming
57 return n if n < 2 else fib(n - 1) + fib(n - 2)
59 # cache least recently used Python Enhancement Proposals
60 @cached(cache=LRUCache(maxsize=32))
62 url = 'http://www.python.org/dev/peps/pep-%04d/' % num
63 with urllib.request.urlopen(url) as s:
66 # cache weather data for no longer than ten minutes
67 @cached(cache=TTLCache(maxsize=1024, ttl=600))
68 def get_weather(place):
69 return owm.weather_at_place(place).get_weather()
71 For the purpose of this module, a *cache* is a mutable_ mapping_ of a
72 fixed maximum size. When the cache is full, i.e. by adding another
73 item the cache would exceed its maximum size, the cache must choose
74 which item(s) to discard based on a suitable `cache algorithm`_. In
75 general, a cache's size is the total size of its items, and an item's
76 size is a property or function of its value, e.g. the result of
77 ``sys.getsizeof(value)``. For the trivial but common case that each
78 item counts as 1, a cache's size is equal to the number of its
79 items, or ``len(cache)``.
81 Multiple cache classes based on different caching algorithms are
82 implemented, and decorators for easily memoizing function and method
83 calls are provided, too.
86 ------------------------------------------------------------------------
88 cachetools is available from PyPI_ and can be installed by running::
90 pip install cachetools
93 ------------------------------------------------------------------------
101 ------------------------------------------------------------------------
103 Copyright (c) 2014-2020 Thomas Kemmer.
105 Licensed under the `MIT License`_.
108 http://docs.python.org/3/library/functools.html#functools.lru_cache
109 .. _mutable: http://docs.python.org/dev/glossary.html#term-mutable
110 .. _mapping: http://docs.python.org/dev/glossary.html#term-mapping
111 .. _cache algorithm: http://en.wikipedia.org/wiki/Cache_algorithms
113 .. _PyPI: https://pypi.org/project/cachetools/
114 .. _Documentation: https://cachetools.readthedocs.io/
115 .. _Issue tracker: https://github.com/tkem/cachetools/issues/
116 .. _Source code: https://github.com/tkem/cachetools/
118 https://github.com/tkem/cachetools/blob/master/CHANGELOG.rst
119 .. _MIT License: http://raw.github.com/tkem/cachetools/master/LICENSE
123 1d057645db16ca7fe1f3bd953558897603d6f0b9c51ed9d11eb4d071ec4e2aab 22229 cachetools-4.1.0.tar.gz