Skip to content

locaweb/heartcheck-cache

Repository files navigation

Heartcheck::Cache

Build Status Code Climate

##A plugin to check cache connection with heartcheck.

Installation

Add this line to your application's Gemfile:

gem 'heartcheck-cache'

And then execute:

$ bundle

Or install it yourself as:

$ gem install heartcheck-cache

Usage

You can check any cache connection that there's in your app. Each service need to respond to :name (an indetifier) and :connection (an activerecord connection)

Heartcheck.setup do |config|
  config.add :cache do |c|
    c.add_service(name: 'MyCacheConnection', connection: Dalli::Client.new('localhost:11211'))
  end
end

If you need check the Rails.cache this service need be added with dynamic service; The dynamic service is a Hash that needs to respond to :name to identify the service and :connection that is recommended to use the cache connection that your app is using. Ex.

Heartcheck.setup do |config|
  config.add :cache do |c|
    c.add_service(name: 'MyRailsCacheConnection', connection: Rails.cache.instance_variable_get("@data"))
  end
end

Check Heartcheck example here

License

Contributing

  1. Fork it ( https://github.com/locaweb/heartcheck-cache )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request