Skip to content

amcaplan/cache_clear

Repository files navigation

CacheClear

Gem Version Travis Status

CacheClear is a simple pre-built solution for adding a cache-clearing endpoint to your Rails app.

Just send a DELETE request to /cache_clear and the Rails cache will be cleared. No need to enter the Rails console!

You can (and should!) configure CacheClear to use an authorization token, to make sure no evil would-be DDoSers crash your app by continuously emptying the caches.

CacheClear is great as a way for scripts (e.g. hubot) to clear caches remotely without needing to directly touch your production servers.

How to include CacheClear in your project

  1. Add it to your gemfile:
gem 'cache_clear'
  1. Mount it in config/routes.rb:
YourApp::Application.routes.draw do
  mount CacheClear::Engine => "/cache_clear" # or a route of your choosing
  # the rest of your file
end
  1. Optional but strongly recommended: Set up authentication in an initializer (e.g., config/initializers/cache_clear.rb):
CacheClear.configure do |config|
  config.auth_token = "super_secure_string"
end

...and you're good to go!

License

This project uses the MIT-LICENSE.

About

Easily set up a cache-clearing endpoint for your Rails app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published