@@ -41,6 +41,12 @@ of the cache. When a cache is full, :meth:`Cache.__setitem__()` calls
41
41
:meth: `self.popitem() ` repeatedly until there is enough room for the
42
42
item to be added.
43
43
44
+ .. note ::
45
+
46
+ Please be aware that `maxsize ` must be a positive number. If you
47
+ really want your cache to grow without bounds, use
48
+ :const: `math.inf ` or something similar.
49
+
44
50
In general, a cache's size is the total size of its item's values.
45
51
Therefore, :class: `Cache ` provides a :meth: `getsizeof ` method, which
46
52
returns the size of a given `value `. The default implementation of
@@ -50,12 +56,12 @@ making the cache's size equal to the number of its items, or
50
56
named constructor parameter `getsizeof `, which may specify a function
51
57
of one argument used to retrieve the size of an item's value.
52
58
53
- Note that the values of a :class: `Cache ` are mutable by default, as
54
- are e.g. the values of a :class: `dict `. It is the user's
55
- responsibility to take care that cached values are not accidentally
56
- modified. This is especially important when using a custom
57
- ` getsizeof ` function, since the size of an item's value will only be
58
- computed when the item is inserted into the cache.
59
+ The values of a :class: `Cache ` are mutable by default, as are e.g. the
60
+ values of a :class: `dict `. It is the user's responsibility to take
61
+ care that cached values are not accidentally modified. This is
62
+ especially important when using a custom ` getsizeof ` function, since
63
+ the size of an item's value will only be computed when the item is
64
+ inserted into the cache.
59
65
60
66
.. note ::
61
67
0 commit comments