All notable changes to this project are documented in this file.
This project adheres to Semantic Versioning.
Entries marked as BC BREAK indicate backward-incompatible changes.
- Development dependencies are now declared in the
devdependency group instead of as a published optional dependency. - Invalid argument types now raise
TypeError, while invalid values and configuration continue to raiseValueError.
- BC BREAK: Removed the Global Cache API (
pluca.cache) and its named cache registry and configuration helpers. Applications must create and managepluca.Cacheinstances directly. - BC BREAK: Composite adapters no longer accept constructor configuration
mappings or
add_cache_config(). The publicpluca.utils.create_cache()factory and its factory-path helpers were also removed. Child caches must be instantiated explicitly and added withCompositeAdapter.add_cache().
Cache.get_put()and cache decorators now support dependency-based invalidation viadependency=. Dependency state is tracked in companion keys under the internal__pluca_dep__namespace so cache values are recomputed when external state changes.- New
pluca.invalidationstdlib-only helper probes for dependency tracking, including file mtimes, SQLite scalar queries, environment variables, and probe composition viacombine()withCombineOperator.OR/CombineOperator.ANDsemantics. - Added
Cache.set_max_age()and adapter-levelset_max_age_mapped()support to update expiration for existing entries without changing their values. - Cache instances now support
enable_dependencies(defaultTrue). When disabled, calls usingdependency=raiseCacheConfigurationErrorand skip dependency-check overhead. - Added a generic
CacheBackendErrorcontract for adapter backend technology failures. Adapter/backend exceptions now re-raiseCacheBackendErrorwith exception chaining (raise ... from ex) when an underlying exception is available. - Added a new
pluca.multiprocessingadapter backed bymultiprocessing.Manager().dict()for shared in-memory cache use across local processes.
- DBM adapter
shutdown()now closes only handles opened by the adapter itself. Caller-provided/open DBM handles are no longer closed unexpectedly.
- Benchmark reliability and timing methodology improvements.
- A new
CompositeCachebackend for composing multiple cache strategies. - New cache utility helpers, including
create_cachedir_tag()and shared cache-creation logic. - New global cache helpers:
flush(),gc(), and ashutdownoption forremove()/remove_all(). Nonecan now be used as an alias for the root/global cache.- DBM backend support for
pathlib.Pathvalues. - A
task spellcheckcommand powered bycodespell. - Optional class-loading allowlists for dynamic cache configuration APIs
(
dict_config(),file_config(), and composite cache config loading). - New global
from_toml()helper for TOML-based cache configuration. - README documentation now recommends TOML over INI when possible because
TOML preserves value types, and clarifies the reserved
__root__section/table convention used for root cache configuration. - File backend locking is now configurable via
locking=('auto', mechanism name, orNone). The default auto-selects the most efficient stdlib mechanism for the current platform. Locking is applied per cache entry file, andlocking='mkdir'is available for NFS-friendly locking with stale-lock handling.
- README examples and API reference now match the current cache, global configuration, and composite-cache behavior.
FileCachecache names are hardened against path traversal inputs.FileCache.flush()andFileCache.gc()are now safe no-ops on fresh caches (or after cache-directory removal) instead of raisingFileNotFoundError.- Global
pluca.cache.gc()now behaves correctly even when a backend does not implement GC. - Root cache removal is now idempotent (safe to call multiple times).
- DBM now respects
max_agecorrectly. max_age=0now expires entries immediately across memory, DBM, and SQL backends.- Global
file_config()now coerces INI booleans and numeric values before passing backend kwargs, avoiding delayed type errors at runtime. - SQLite3
put_many()is now atomic and commits once per call, avoiding partial writes when a batch entry fails. - SQLite3 batch reads/removals now explicitly support empty key iterables,
and regression tests cover empty list/tuple/generator inputs to prevent
IN ()SQL regressions. CompositeCache.remove()now attempts all tiers before failing, so a miss in an upper tier no longer leaves stale values in lower tiers.- SQLite3 now validates SQL identifiers used for dynamic names (including
PRAGMA directives) and rejects invalid inputs with
ValueError. - Developer-quality fixes: restored missing mypy overrides, fixed test file encoding warnings, and cleaned spelling/docs issues.
- DBM tests are now stdlib-portable and no longer skip when optional DBM variants are unavailable.
get_child(None, child)andget_child('', child)now resolve the same node asget_cache(child)instead of building a leading-dot path.tests.test_utils.TestUtils._assert_cache_dir_tagnow checksPath.is_file()correctly, so missingCACHEDIR.TAGfiles fail with a clear assertion.
- SQLite3 now creates new cache tables with
WITHOUT ROWID. - Packaging/build system moved to Flit.
- BC BREAK: The project now requires Python 3.11+.
- BC BREAK: Backend implementation now uses adapters instead of
pluca.Cachesubclass inheritance. Built-in backend modules now exposeAdapteradapter classes, and module-only factories resolve to:Adapter. - BC BREAK: Internal cache ABC method names were standardized (
key->mkey,flush->_flush), which may require updates in custom backend subclasses. - BC BREAK: Core SQL support no longer includes PostgreSQL and MySQL specific behavior. PostgreSQL/MySQL support will move to separate packages.
- BC BREAK: Removed the generic
pluca.sqlbackend from core. Core SQL cache support is now SQLite-only viapluca.sqlite3. - BC BREAK: Global cache configuration helpers were renamed:
dict_config()->from_dict()andfile_config()->from_config().
- PostgreSQL/MySQL integration tests from the core repository.
- Docker-based test infrastructure used for PostgreSQL/MySQL integration tests.
- The
pluca.sqlmodule from the core package.
remove_many()andshutdown()APIs for better lifecycle and bulk-removal control.- A SQLite3 backend.
- DBM backend support for direct DBM file-name inputs.
- SQL backend
__repr__output was corrected. - File backend writes now use temporary files to reduce race-condition risks in concurrent scenarios.
- A benchmark module.
- A
pruneoption in the memory backend for bounded in-memory cache behavior.
- Memory backend serialization now behaves correctly.
- Memory backend garbage collection now correctly removes expired entries.
- Expanded linting quality checks (
pylintextensions), disallowedprint(), and cleaned up backend representation/dataclass consistency.
- SQL and DBM backends.
file_config()in the global cache API.- SQL placeholder customization for cross-driver compatibility.
- SQL support for MySQL
INSERT ... ON DUPLICATEupserts. - PostgreSQL and MariaDB/MySQL test suites.
- Docker Compose support for DB integration tests and multi-Python test runs.
- File backend persistence of pickled data is more robust.
- Generic cache contract tests now explicitly exercise
gc()behavior. - SQL backend now properly implements garbage collection.
- DBM tests no longer leave temporary files behind.
get_many()now handlesNonedefaults correctly.put()now validatesmax_ageinputs.- Added a pickle-security note and other README improvements.
- Utility developer tasks and a QA script.
- Generic tests for key-type behavior.
- Decorator use with parameters no longer raises unexpected exceptions.
- Null adapter signatures and methods were corrected/simplified.
Cachebase class abstractness issue was fixed.get_many()/put_many()now work better with dict inputs.- Typing coverage and mypy configuration were improved.
- Expanded README caveats/examples and improved class docstrings.
- BC BREAK: Global cache API was refactored for a simpler developer-facing interface.
- BC BREAK: Adapter classes were removed, which may require migration for integrations relying on adapter-specific APIs.
- BC BREAK: Key mapping internals changed (
_get_cahe_key->_map_key) and key derivation now usesrepr((type, key)), which can change cache-key values across upgrades. - File backend cache name/directory mapping was refactored for clearer behavior.
- BC BREAK: Renamed the cache-interface
cache_namefield to avoid naming conflicts in integrations.
- Dynamic cache interface support.
- Decorator-based caching support.
- Packaging metadata now includes the README in
setup.cfg. - Version handling switched to dynamic versioning for cleaner release management.
- Initial public project packaging and scaffolding.
- README and package classifiers.
- Initial unit test suite, including behavior for removing missing keys.
- Memory and null cache adapters.
- Early cache interface and adapter naming were refactored during initial release preparation.
- Default cache-key hashing switched to SHA1.