Skip to content

Commit 72491b3

Browse files
committed
docs/btree: Describe page caching policy of the underlying implementation.
1 parent 7516332 commit 72491b3

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

docs/library/btree.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,24 @@ Example::
7676
Functions
7777
---------
7878

79-
.. function:: open(stream, \*, flags=0, cachesize=0, pagesize=0, minkeypage=0)
79+
.. function:: open(stream, \*, flags=0, pagesize=0, cachesize=0, minkeypage=0)
8080

8181
Open a database from a random-access `stream` (like an open file). All
8282
other parameters are optional and keyword-only, and allow to tweak advanced
8383
parameters of the database operation (most users will not need them):
8484

8585
* *flags* - Currently unused.
86-
* *cachesize* - Suggested maximum memory cache size in bytes. For a
87-
board with enough memory using larger values may improve performance.
88-
The value is only a recommendation, the module may use more memory if
89-
values set too low.
9086
* *pagesize* - Page size used for the nodes in BTree. Acceptable range
91-
is 512-65536. If 0, underlying I/O block size will be used (the best
92-
compromise between memory usage and performance).
87+
is 512-65536. If 0, a port-specific default will be used, optimized for
88+
port's memory usage and/or performance.
89+
* *cachesize* - Suggested memory cache size in bytes. For a
90+
board with enough memory using larger values may improve performance.
91+
Cache policy is as follows: entire cache is not allocated at once;
92+
instead, accessing a new page in database will allocate a memory buffer
93+
for it, until value specified by *cachesize* is reached. Then, these
94+
buffers will be managed using LRU (least recently used) policy. More
95+
buffers may still be allocated if needed (e.g., if a database contains
96+
big keys and/or values). Allocated cache buffers aren't reclaimed.
9397
* *minkeypage* - Minimum number of keys to store per page. Default value
9498
of 0 equivalent to 2.
9599

0 commit comments

Comments
 (0)