Expand description
Shared binary cache for PostgreSQL downloads.
This module provides caching infrastructure to avoid repeated downloads of
PostgreSQL binaries when multiple tests or processes need the same version.
Binaries are stored in a user-specific cache directory and shared across test
runs.
§Cache Location
The cache directory is resolved by resolve_cache_dir in the following order:
PG_BINARY_CACHE_DIRenvironment variable if set$XDG_CACHE_HOME/pg-embedded/binariesifXDG_CACHE_HOMEis set~/.cache/pg-embedded/binariesif the home directory is available/tmp/pg-embedded/binariesas last resort when none of the above are available
§Cross-Process Coordination
The cache uses file-based locking to coordinate downloads across parallel test runners. Locks are per-version, allowing different versions to be downloaded concurrently.
Structs§
- Binary
Cache Config - Configuration for the shared binary cache.
- Cache
Lock - Guard that holds a file lock until dropped.
Enums§
- Cache
Lookup Result - Result of a cache lookup operation.
Functions§
- check_
cache - Checks if the cache contains valid binaries for the given version.
- copy_
from_ cache - Copies cached binaries to the target installation directory.
- find_
matching_ cached_ version - Finds a cached version that satisfies the given version requirement.
- populate_
cache - Populates the cache with binaries from the given source directory.
- resolve_
cache_ dir - Resolves the binary cache directory from environment and XDG conventions.
- try_
populate_ cache - Attempts to populate the cache after a download, logging warnings on failure.
- try_
use_ cache - Attempts to use the cache, falling back gracefully on errors.