Repository navigation
Add configure() and DISKCACHE_DISK so caches created without a disk use a process-wide default, with an explicit disk always winning - #24
Merged
Conversation
Documentation build overview
7 files changed ·
|
…se a process-wide default, with an explicit disk always winning.
avgvi
force-pushed
the
feat/safedisk-with-types
branch
from
October 18, 2026 19:14
56cf9b9 to
a12c6ab
Compare
avgvi
force-pushed
the
feat/configure-default-disk
branch
from
October 18, 2026 19:14
db65f75 to
dc35bfd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a process-wide default disk, so an application can turn on
SafeDiskfor caches that libraries create for it without patching those libraries.configure(disk)sets the disk type of everyCache,FanoutCache,Deque,IndexandDjangoCachecreated afterwards without a disk, returns the previous setting, andconfigure(None)clears it.default_disk()returns the type in effect.configure, the environment decides:DISKCACHE_DISK=safeselectsSafeDisk, withDISKCACHE_SAFE_TYPES(import paths) andDISKCACHE_SAFE_MODULES(module names) passed toSafeDisk.with_types;DISKCACHE_DISKalso takesdefaultor the import path of a disk class. Invalid values raiseValueErrornaming the variable.disk=argument, thenconfigure, then the environment, thenDisk. Libraries that pass their own disk keep it, caches that already exist keep theirs, and nothing is written to the cache directory.diskarguments ofCache,FanoutCache,Deque,Indexand the DjangoDISKoption now default toNone, meaning that type.tests/test_default_disk.pyfor every container, the precedence, the environment forms and errors, pickled caches and persistence.Stacked on #23.
Verified: 484 tests pass on Python 3.12; blue, isort, flake8, mypy, doc8 and the Sphinx build with warnings as errors pass.