Skip to content

Let Cache take a dbname argument for its SQLite file name instead of the global cache.db - #53

Merged
avgvi merged 1 commit into
masterfrom
cache-dbname
Nov 11, 2026
Merged

avgvi merged 1 commit into
masterfrom
cache-dbname

Conversation

@avgvi

@avgvi avgvi commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Lets Cache keep its SQLite database under a file name other than cache.db. Until now the only way was to override the private _con to open another file, and such an override skips the connection registry, the read-only mode=ro open and the read-only check.

  • Argument: Cache(directory, ..., dbname=None), keyword-only like read_only. None means core.DBNAME, looked up on each call, so code that sets core.DBNAME after import still renames the file. Anything other than a plain file name (an empty name, ., .., a path or a non-string) raises ValueError before anything is created.
  • Uses: _connect opens directory/dbname, the read-only check looks at that file, and check() skips it and its -wal/-shm files. check() matches paths as it does on master.

Tests: 1004 passed and 2 skipped, coverage 99.23%.

blue, isort, flake8, mypy and doc8 pass, and pylint reports the same messages as on master. The Sphinx docs build was not run locally.

@read-the-docs-community

read-the-docs-community Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 diskcache-community | 🛠️ Build #35807801 | 📁 Comparing 0f0daa3 against latest (62e09da)

  🔍 Preview build  

1 file changed
± api.html

@avgvi avgvi changed the title Let Cache take a dbname argument for its SQLite file name instead of the global cache.db Let a Cache subclass name its SQLite file with a dbname attribute instead of the global cache.db Nov 11, 2026
@avgvi avgvi changed the title Let a Cache subclass name its SQLite file with a dbname attribute instead of the global cache.db Let Cache take a dbname argument for its SQLite file name instead of the global cache.db Nov 11, 2026
@avgvi avgvi changed the title Let Cache take a dbname argument for its SQLite file name instead of the global cache.db Let Cache, FanoutCache, Deque and Index take a dbname argument for their SQLite file name instead of the global cache.db Nov 11, 2026
@avgvi avgvi changed the title Let Cache, FanoutCache, Deque and Index take a dbname argument for their SQLite file name instead of the global cache.db Let Cache take a dbname argument for its SQLite file name instead of the global cache.db Nov 11, 2026
@avgvi
avgvi merged commit 183c0c9 into master Nov 11, 2026
21 checks passed
@avgvi
avgvi deleted the cache-dbname branch November 11, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant