cachetools 7.3.3__tar.gz → 7.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {cachetools-7.3.3 → cachetools-7.3.4}/CHANGELOG.rst +8 -0
  2. {cachetools-7.3.3/src/cachetools.egg-info → cachetools-7.3.4}/PKG-INFO +1 -1
  3. {cachetools-7.3.3 → cachetools-7.3.4}/docs/index.rst +10 -0
  4. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/__init__.py +1 -1
  5. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/func.py +9 -5
  6. {cachetools-7.3.3 → cachetools-7.3.4/src/cachetools.egg-info}/PKG-INFO +1 -1
  7. {cachetools-7.3.3 → cachetools-7.3.4}/LICENSE +0 -0
  8. {cachetools-7.3.3 → cachetools-7.3.4}/MANIFEST.in +0 -0
  9. {cachetools-7.3.3 → cachetools-7.3.4}/README.rst +0 -0
  10. {cachetools-7.3.3 → cachetools-7.3.4}/docs/conf.py +0 -0
  11. {cachetools-7.3.3 → cachetools-7.3.4}/pyproject.toml +0 -0
  12. {cachetools-7.3.3 → cachetools-7.3.4}/setup.cfg +0 -0
  13. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/__init__.pyi +0 -0
  14. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/_cached.py +0 -0
  15. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/_cachedmethod.py +0 -0
  16. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/_descriptor.py +0 -0
  17. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/func.pyi +0 -0
  18. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/keys.py +0 -0
  19. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/keys.pyi +0 -0
  20. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools/py.typed +0 -0
  21. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools.egg-info/SOURCES.txt +0 -0
  22. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools.egg-info/dependency_links.txt +0 -0
  23. {cachetools-7.3.3 → cachetools-7.3.4}/src/cachetools.egg-info/top_level.txt +0 -0
  24. {cachetools-7.3.3 → cachetools-7.3.4}/tests/__init__.py +0 -0
  25. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_cache.py +0 -0
  26. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_cached.py +0 -0
  27. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_cachedmethod.py +0 -0
  28. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_classmethod.py +0 -0
  29. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_fifo.py +0 -0
  30. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_func.py +0 -0
  31. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_keys.py +0 -0
  32. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_lfu.py +0 -0
  33. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_lru.py +0 -0
  34. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_rr.py +0 -0
  35. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_threading.py +0 -0
  36. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_tlru.py +0 -0
  37. {cachetools-7.3.3 → cachetools-7.3.4}/tests/test_ttl.py +0 -0
  38. {cachetools-7.3.3 → cachetools-7.3.4}/tox.ini +0 -0
@@ -1,3 +1,11 @@
1
+ v7.3.4 (2026-11-25)
2
+ ===================
3
+
4
+ - Minor ``cachetools.func`` performance improvements.
5
+
6
+ - Minor documentation improvements.
7
+
8
+
1
9
  v7.3.3 (2026-11-18)
2
10
  ===================
3
11
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachetools
3
- Version: 7.3.3
3
+ Version: 7.3.4
4
4
  Summary: Extensible memoizing collections and decorators
5
5
  Author-email: Thomas Kemmer <tkemmer@computer.org>
6
6
  Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
@@ -110,6 +110,12 @@ inserted into the cache.
110
110
  This class discards the least recently used items first to make
111
111
  space when necessary.
112
112
 
113
+ Retrieving an item via :meth:`LRUCache.__getitem__` marks it as
114
+ most recently used, as does inserting or updating it. Since
115
+ :meth:`items` and :meth:`values` retrieve every item in turn,
116
+ iterating over these views leaves the cache discarding items in
117
+ insertion order.
118
+
113
119
  .. autoclass:: RRCache(maxsize, choice=random.choice, getsizeof=None)
114
120
  :members: choice, popitem
115
121
 
@@ -372,6 +378,10 @@ often called with the same arguments:
372
378
  condition variable must be created with the corresponding lock,
373
379
  e.g. ``condition=threading.Condition(lock)``; an unrelated
374
380
  :class:`threading.Condition` will raise :exc:`RuntimeError`.
381
+ On current CPython versions, passing the lock separately this
382
+ way is also slightly faster than providing `condition` alone,
383
+ since acquiring the lock through a :class:`threading.Condition`
384
+ adds Python-level method calls on every cache access.
375
385
 
376
386
  The decorator's `cache`, `key`, `lock` and `condition` parameters
377
387
  are also available as :attr:`cache`, :attr:`cache_key`,
@@ -12,7 +12,7 @@ __all__ = (
12
12
  "cachedmethod",
13
13
  )
14
14
 
15
- __version__ = "7.3.3"
15
+ __version__ = "7.3.4"
16
16
 
17
17
  import collections
18
18
  import collections.abc
@@ -5,7 +5,7 @@ __all__ = ("fifo_cache", "lfu_cache", "lru_cache", "rr_cache", "ttl_cache")
5
5
  import math
6
6
  import random
7
7
  import time
8
- from threading import Condition
8
+ from threading import Condition, RLock
9
9
 
10
10
  from . import FIFOCache, LFUCache, LRUCache, RRCache, TTLCache, cached, keys
11
11
 
@@ -21,11 +21,15 @@ class _UnboundTTLCache(TTLCache):
21
21
 
22
22
  def _cache(cache, maxsize, typed):
23
23
  def decorator(func):
24
- # like functools.lru_cache, this has to be thread-safe;
25
- # additionally, this also prevents cache stampede scenarios
26
- # using a condition variable
24
+ # Like functools.lru_cache, this has to be thread-safe. Using
25
+ # a condition variable also prevents cache stampedes. Passing
26
+ # its lock separately skips the Python-level __enter__() and
27
+ # __exit__() methods of Condition on every call.
27
28
  key = keys.typedkey if typed else keys.hashkey
28
- wrapper = cached(cache=cache, key=key, condition=Condition(), info=True)(func)
29
+ lock = RLock()
30
+ wrapper = cached(
31
+ cache=cache, key=key, lock=lock, condition=Condition(lock), info=True
32
+ )(func)
29
33
  wrapper.cache_parameters = lambda: {"maxsize": maxsize, "typed": typed} # type: ignore
30
34
  return wrapper
31
35
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachetools
3
- Version: 7.3.3
3
+ Version: 7.3.4
4
4
  Summary: Extensible memoizing collections and decorators
5
5
  Author-email: Thomas Kemmer <tkemmer@computer.org>
6
6
  Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes