Skip to content

Commit f5ba8db

Browse files
committed
Update docs for #302
Since all resolvers are now cached, the original example doesn't work anymore. Also some wording changes around. Fixes #305
1 parent c85e4e3 commit f5ba8db

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

doc/guides.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,9 @@ composing :class:`~ua_parser.Resolver` objects.
9393
The most basic such customisation is simply configuring caching away
9494
from the default setup.
9595

96-
As an example, in the default configuration if |regex|_ is available
97-
the regex-based resolver is not cached, a user might consider the
98-
memory investment worth it and want to reconfigure the stack for a
99-
cached base.
96+
As an example, all resolvers are cached with an
97+
:class:`~ua_parser.caching.S3Fifo` of size 2000, a user's workload
98+
might lead them to favor a larger LRU.
10099

101100
The process is uncomplicated as the APIs are designed to compose
102101
together.
@@ -112,7 +111,7 @@ the relevant :class:`Matchers` data::
112111
The next step is to instantiate the cache [#cache]_ suitably
113112
configured::
114113

115-
cache = ua_parser.Cache(1000)
114+
cache = ua_parser.caching.Lru(10000)
116115

117116
And compose the base resolver and cache together::
118117

@@ -136,6 +135,11 @@ from here on::
136135
:class:`~ua_parser.caching.Local`, which is also caching-related,
137136
and serves to use thread-local caches rather than a shared cache.
138137

138+
Although this does not remove the cache locks it avoids contention
139+
on the locks, which can be useful when using a free-threaded
140+
interpreter, especially when using the LRU cache as it has to
141+
synchronise on hit.
142+
139143
.. _builtin-resolvers:
140144

141145
Builtin Resolvers

0 commit comments

Comments
 (0)