How do I know if my cache is being used?

Hey I have set up some cache directories, and they are saving successfully.
They seem to be loading up as well, however, the commands that install the cached files are still running.
Will ci deal with this automatically, or do I need to check if the folder exists before running my install commands.

For example. I am usign composer to install some dependancies.
I have cached the /vendor folder, and that seems to be successful, but composer still runs all the commands and still takes the same amount of time.

Should I put the composer command inside a bash script that checks if the folder exists, and if it does, then skip the install command.

I’m going to try it and see what happens.
If anyone has a better idea, I’d be much appreciated


Hi @cloudEdwards,

We don’t do any checking to prevent dependencies installation if the folder already exists, as there isn’t a smart way to determine whether or not the individual packages need to be updated. We rely on the package manager to figure out which modules need to be installed, and it looks like composer just installs everything every time. One thing you can do to work around this is to add composer’s cache to your cache_directories by adding the following to your circle.yml:

    - ~/.composer/cache

Composer will still install your packages in every build, but this will at least prevent it from needing to download the packages.

Hope this helps!

This totally works, thanks Frank. Now composer is loading everything from the cache and it takes 3 seconds :slight_smile: