How to overwrite cache?


#1

Hello

How to overwrite cache?
I think that if cache key already exists, It’s overwrite.

Skipping cache generation, cache already exists for key: cache_key
Found one created at 2017-06-06 04:10:46 +0000 UTC

#2

I’d support the topic starter here. It would be nice to have the option like “Drop the cache” next to the “Rebuild without cache”.

“Drop the cache” would take the key defined in circle yml and attempt to drop it while running the build (on Restore the cache step), resulting the cache being re-generated after the successful build.

What does everybody think about this?


#3

Thanks for reply.

Ok, I want to use force regenerate cache.
Like this

save_cache: 
  key: key1
  path: /tmp/foo

save_cache:
  key: key2
  path: /tmp/var
  force: yes  => regenerate cache `key2`

#4

I want this too. I restore my node_modules from cache (using package.json as a key), then run npm install anyway because it might well pick up new dependency patches, even if my package.json hasn’t changed since last build.

Until CircleCI gives us a way to drop the cache (or force-saving it regardless of whether the cache key already exists), my cached node_modules folder will fall further and further behind until my package.json next changes.


#5

I would like to see that implemented as well. The complexity is much higher if I have only the choice of renewing the cache by adding new keys.


#6

Agreed, there’s needs to be more tooling around cache management. The suggestion from the documentation about just incrementing an arbitrary version number in the cache key prefix is not a good enough solution.


#7

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.