Skip to content

Commit d3694b6

Browse files
author
Erlend E. Aasland
committed
Update documentation
1 parent a617fa4 commit d3694b6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Doc/library/sqlite3.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,16 @@ Connection Objects
515515

516516
.. XXX what's a db_row-based solution?
517517
518+
.. method:: statement_cache()
519+
520+
Returns the LRU statement cache for this connection. The statement
521+
cache is implemented using :meth:`functools.lru_cache`, so it's
522+
possible to inspect its state by calling :func:`~functools.cache_info`
523+
or :func:`~functools.cache_parameters` on the returned object. The
524+
cache can be cleared by calling :func:`~functools.cache_clear` on
525+
the returned object.
526+
527+
.. versionadded:: 3.10
518528

519529
.. attribute:: text_factory
520530

Doc/whatsnew/3.10.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,12 @@ Add audit events for :func:`~sqlite3.connect/handle`,
12311231
:meth:`~sqlite3.Connection.load_extension`.
12321232
(Contributed by Erlend E. Aasland in :issue:`43762`.)
12331233
1234+
1235+
:mod:`sqlite3` now utilizes :meth:`functools.lru_cache` to implement the
1236+
connection statement cache. The statement cache can be accessed via the new
1237+
method :meth:`sqlite3.Connection.statement_cache`.
1238+
(Contributed by Erlend E. Aasland in :issue:`42862`.)
1239+
12341240
sys
12351241
---
12361242

0 commit comments

Comments
 (0)