Set custom stores #38

wants to merge 3 commits into


None yet
5 participants

tekwiz commented Sep 11, 2011

This allows the registration and resolution of custom stores.

Example from updated docs:

use Rack::Cache do |rack_cache|
  rack_cache.register_metastore, :my_metas,
  rack_cache.register_entitystore, :my_entities,
  rack_cache.use :metastore, :my_metas
  rack_cache.use :entitystore, :my_entities


Rack::Cache::Storage.instance.register_metastore :my_metas,
Rack::Cache::Storage.instance.register_entitystore :my_entities,

use Rack::Cache,
  :metastore => :my_metas,
  :entitystore => :my_entities

This is especially useful for redis-store when you use a distributed instance:

redis_servers = %w(redis:// redis://
use Rack::Cache do |rack_cache|
  rack_cache.register_metastore, :default,
  rack_cache.use :metastore, :my_metas


afeld commented Feb 2, 2012



rtomayko commented Feb 17, 2012

Really sorry for the lack of attention on this. I definitely like this patch in concept. It's something that should have been done a long time ago and cleans up a really ugly part of the codebase.

I do think we should stick with URIs as storage identifiers instead of adding names, though. It's a little more work for the store implementation but allows for common things like hostnames, namespaces, and params to be given a standard way.

I'd also like the built in stores to use the same interfaces for registering as custom stores.

I'm planning on spending a couple days in rack-cache this weekend maybe. I'd love to use this as a base for moving things in a slightly different direction. Does that sound okay?

cfis commented Oct 15, 2012

Hi Ryan,

Travis and I worked on this one - any chance of pushing it forward? Need a new patch?

Thanks - Charlie


grosser commented Oct 8, 2015

please reopen if still needed

grosser closed this Oct 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment