Skip to content

Commit c03a7ee

Browse files
committed
Fix #328: Add note about maxsize being an actual number.
1 parent 72b4a32 commit c03a7ee

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

docs/index.rst

+12-6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ of the cache. When a cache is full, :meth:`Cache.__setitem__()` calls
4141
:meth:`self.popitem()` repeatedly until there is enough room for the
4242
item to be added.
4343

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+
4450
In general, a cache's size is the total size of its item's values.
4551
Therefore, :class:`Cache` provides a :meth:`getsizeof` method, which
4652
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
5056
named constructor parameter `getsizeof`, which may specify a function
5157
of one argument used to retrieve the size of an item's value.
5258

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.
5965

6066
.. note::
6167

0 commit comments

Comments
 (0)