cache.prune_compilation_cache

cache.prune_compilation_cache(
    directory=None,
    max_bytes=_MAX_BYTES,
    *,
    force=False,
)

Delete the oldest cache entries until the directory fits max_bytes.

Runs at most once per :data:_PRUNE_INTERVAL_SECONDS unless force: the check is one stat of a stamp file, cheap enough for every worker process to make. Age is the later of an entry’s access and modification time, so on a filesystem that records reads it is least-recently-used, and least-recently-written otherwise. It also removes the -atime files JAX’s own eviction left beside every entry; nothing reads them once that eviction is off.

Parameters

Name Type Description Default
directory str | os.PathLike[str] | None The cache; defaults to :func:cache_directory. None
max_bytes int Size budget for the -cache entries. _MAX_BYTES
force bool Prune even if the last prune was recent. False

Returns

Name Type Description
int The number of entries removed (stale -atime files not counted).