Invalidate precompilation cache

How can I invalidate the precompilation cache in a programmable way from within julia, to force precompilation upon restart ?

2 Likes

You can delete the files.

Sure :slight_smile: , but is there are Base officially supported way ?

I need to add this to Plots in select `Plots` backend via `Preferences` (or env variable) by t-bltg · Pull Request #4566 · JuliaPlots/Plots.jl · GitHub, upon changing the backend via Preferences.

1 Like

I’ve really wanted this too.

1 Like

This seems to work:

rm.(Base.find_all_in_cache_path(Base.module_keys[Plots]))
1 Like

Preferences.jl should address this as long as you use @load_preference during every precompilation.

If you don’t use it during a precompilation session, then Julia will not know it should check that file and will not invalidate the cache.

1 Like

Would be nice to have an official API for this if people want to propose one.

Doesn’t Base.compilecache do that already?

1 Like