valyala/ybc

clear cache

millken opened this issue · 1 comments

in the cdn,i want to clear the a.com cache.
the keys like this, and how to clear?

cache:a.com:get:/index.html
cache:a.com:get:/js/1.js
cache:a.com:get:/js/2.css
...
cache:b.com:get:/index.html
...

Currently there is no possibility to clear cached entries in go-cdn-booster and it won't be added in the future.
Use new urls for updated static resources instead. For example, every time /js/1.js is updated, update the 'revision' number integrated into static resource's url like this:

/js/1.js?revision=1234

Revision number can be generated in multiple ways:

  • Deployed source code's revision number. This approach has a drawback that all static resources are effectively invalidated on every push to production even if they didn't change since the previous push.
  • Static file contents' hash. For example, md5(file_contents('/js/1.js')). Re-calculate these revision numbers only once before application's deployment into production.

Use urls to static content with revision numbers throughout your application and you'll get the profit :)