@@ -85,6 +85,8 @@ def __init__(
8585 iterable (Union[Cache, dict, tuple, Generator, None], optional): Initial data to populate the cache. Defaults to None.
8686 capacity (int, optional): Pre-allocate hash table capacity to minimize reallocations. Defaults to 0.
8787 maxmemory (int, optional): Maximum memory (bytes) allowed for cached entries. Zero means unlimited.
88+ On PyPy, it works same as `maxsize` if objects do not support `__sizeof__`
89+ method.
8890
8991 Creates a new cache with specified size constraints and optional initial data. The cache can be pre-sized
9092 to improve performance when the number of expected elements is known in advance.
@@ -599,8 +601,9 @@ def __init__(
599601 iterable (dict or Iterable[tuple], optional): Initial data to populate the cache. Defaults to None.
600602 capacity (int, optional): Preallocated capacity for the cache to minimize reallocations. Defaults to 0.
601603 maxmemory (int, optional): Maximum memory (bytes) allowed for cached entries. Zero means unlimited.
602- When maxmemory is set, updates can evict any key, including
603- the updated key.
604+ When maxmemory is set, updates can evict any key, including the updated key.
605+ On PyPy. In PyPy, the size of each object is assumed to be 1 if the object
606+ does not have a `__sizeof__` method.
604607
605608 Note:
606609 - The cache size limit is immutable after initialization.
@@ -872,6 +875,8 @@ def __init__(
872875 iterable (dict | Iterable[tuple], optional): Initial data to populate the cache.
873876 capacity (int, optional): Pre-allocated capacity for the cache to minimize reallocations.
874877 maxmemory (int, optional): Maximum memory (bytes) allowed for cached entries. Zero means unlimited.
878+ On PyPy. In PyPy, the size of each object is assumed to be 1 if the object
879+ does not have a `__sizeof__` method.
875880
876881 Notes:
877882 - The cache size is immutable after initialization.
@@ -1152,6 +1157,8 @@ def __init__(
11521157 iterable (dict or Iterable[tuple], optional): Initial data to populate the cache.
11531158 capacity (int, optional): Initial hash table capacity to minimize reallocations. Defaults to 0.
11541159 maxmemory (int, optional): Maximum memory (bytes) allowed for cached entries. Zero means unlimited.
1160+ On PyPy. In PyPy, the size of each object is assumed to be 1 if the object
1161+ does not have a `__sizeof__` method.
11551162
11561163 The cache uses a thread-safe LFU eviction policy, removing least frequently accessed items when the cache reaches its maximum size.
11571164 """
@@ -1443,6 +1450,8 @@ def __init__(
14431450 iterable: Optional initial items to populate the cache, can be a dict or iterable of tuples.
14441451 capacity: Optional initial capacity for the underlying cache storage. Defaults to 0.
14451452 maxmemory: Maximum memory (bytes) allowed for cached entries. Zero means unlimited.
1453+ On PyPy. In PyPy, the size of each object is assumed to be 1 if the object
1454+ does not have a `__sizeof__` method.
14461455
14471456 Raises:
14481457 ValueError: If the time-to-live (ttl) is not a positive number.
@@ -1819,6 +1828,8 @@ def __init__(
18191828 ttl (float or timedelta or datetime, optional): Time-to-live duration for `iterable` items.
18201829 capacity (int, optional): Preallocated capacity for the cache to minimize reallocations.
18211830 maxmemory (int, optional): Maximum memory (bytes) allowed for cached entries. Zero means unlimited.
1831+ On PyPy. In PyPy, the size of each object is assumed to be 1 if the object
1832+ does not have a `__sizeof__` method.
18221833
18231834 Raises:
18241835 ValueError: If provided TTL is zero or negative.
0 commit comments