{"action":"created","issue":{"url":"https://api.github.com/repos/rtomayko/rack-cache/issues/38","labels_url":"https://api.github.com/repos/rtomayko/rack-cache/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/rtomayko/rack-cache/issues/38/comments","events_url":"https://api.github.com/repos/rtomayko/rack-cache/issues/38/events","html_url":"https://github.com/rtomayko/rack-cache/pull/38","id":1616694,"number":38,"title":"Set custom stores","user":{"login":"tekwiz","id":51165,"avatar_url":"https://avatars.githubusercontent.com/u/51165?v=3","gravatar_id":"","url":"https://api.github.com/users/tekwiz","html_url":"https://github.com/tekwiz","followers_url":"https://api.github.com/users/tekwiz/followers","following_url":"https://api.github.com/users/tekwiz/following{/other_user}","gists_url":"https://api.github.com/users/tekwiz/gists{/gist_id}","starred_url":"https://api.github.com/users/tekwiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tekwiz/subscriptions","organizations_url":"https://api.github.com/users/tekwiz/orgs","repos_url":"https://api.github.com/users/tekwiz/repos","events_url":"https://api.github.com/users/tekwiz/events{/privacy}","received_events_url":"https://api.github.com/users/tekwiz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2011-09-11T04:15:25Z","updated_at":"2015-10-08T23:10:47Z","closed_at":"2015-10-08T23:10:47Z","pull_request":{"url":"https://api.github.com/repos/rtomayko/rack-cache/pulls/38","html_url":"https://github.com/rtomayko/rack-cache/pull/38","diff_url":"https://github.com/rtomayko/rack-cache/pull/38.diff","patch_url":"https://github.com/rtomayko/rack-cache/pull/38.patch"},"body":"This allows the registration and resolution of custom stores.\r\n\r\nExample from updated docs:\r\n\r\n```ruby\r\nuse Rack::Cache do |rack_cache|\r\n  rack_cache.register_metastore, :my_metas,\r\n    ::Cache::MetaStore::Heap.new\r\n  rack_cache.register_entitystore, :my_entities,\r\n    ::Cache::EntityStore::Heap.new\r\n  rack_cache.use :metastore, :my_metas\r\n  rack_cache.use :entitystore, :my_entities\r\nend\r\n```\r\n\r\nor\r\n\r\n```ruby\r\nRack::Cache::Storage.instance.register_metastore :my_metas,\r\n  Rack::Cache::MetaStore::Heap.new\r\nRack::Cache::Storage.instance.register_entitystore :my_entities,\r\n  Rack::Cache::EntityStore::Heap.new\r\n\r\nuse Rack::Cache,\r\n  :metastore => :my_metas,\r\n  :entitystore => :my_entities\r\n```\r\n\r\nThis is especially useful for redis-store when you use a distributed instance:\r\n\r\n```ruby\r\nredis_servers = %w(redis://app1.domain.com redis://app2.domain.com)\r\nuse Rack::Cache do |rack_cache|\r\n  rack_cache.register_metastore, :default,\r\n    Rack::Cache::MetaStore::Redis.new(redis_servers)\r\n  rack_cache.use :metastore, :my_metas\r\n\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/rtomayko/rack-cache/issues/comments/146712845","html_url":"https://github.com/rtomayko/rack-cache/pull/38#issuecomment-146712845","issue_url":"https://api.github.com/repos/rtomayko/rack-cache/issues/38","id":146712845,"user":{"login":"grosser","id":11367,"avatar_url":"https://avatars.githubusercontent.com/u/11367?v=3","gravatar_id":"","url":"https://api.github.com/users/grosser","html_url":"https://github.com/grosser","followers_url":"https://api.github.com/users/grosser/followers","following_url":"https://api.github.com/users/grosser/following{/other_user}","gists_url":"https://api.github.com/users/grosser/gists{/gist_id}","starred_url":"https://api.github.com/users/grosser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grosser/subscriptions","organizations_url":"https://api.github.com/users/grosser/orgs","repos_url":"https://api.github.com/users/grosser/repos","events_url":"https://api.github.com/users/grosser/events{/privacy}","received_events_url":"https://api.github.com/users/grosser/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T23:10:47Z","updated_at":"2015-10-08T23:10:47Z","body":"please reopen if still needed"}}