stanbkt.utils.clear_stan_cache#

stanbkt.utils.clear_stan_cache(stan_file=None, cpp_options=None, stanc_options=None, print_fn=None)#

Clear the compiled Stan model cache.

Parameters:
  • stan_file (str | PathLike[str] | None) – If provided, only clear the cache for this specific Stan file with the given compile options. If None, clear the entire cache for all models.

  • cpp_options (dict[str, Any] | None) – C++ compiler options. Only used if stan_file is provided.

  • stanc_options (dict[str, Any] | None) – Stan compiler options. Only used if stan_file is provided.

  • print_fn (Optional[Callable]) – Optional function to print status messages.

Returns:

Number of cache directories removed.

Return type:

int

Examples

Clear the entire cache:

>>> clear_stan_cache()

Clear cache for a specific model:

>>> clear_stan_cache("path/to/model.stan")

Clear cache for a specific model with specific compile options:

>>> clear_stan_cache("path/to/model.stan", cpp_options={"STAN_THREADS": True})