Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rack::Cache cache error: Unknown storage provider #188

Closed
disbelief opened this issue May 26, 2013 · 16 comments
Closed

Rack::Cache cache error: Unknown storage provider #188

disbelief opened this issue May 26, 2013 · 16 comments

Comments

@disbelief
Copy link

Hi there,

I recently attempted to start using redis-store as a back end for the Rack::Cache HTTP caching of my Rails 3.2 app. However I'm seeing the following stacktrace after following the README instructions:

cache error: Unknown storage provider: redis://REDACTED_REDIS_HOST:6379/1/metastore
ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/storage.rb:39:in `create_store'
ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/storage.rb:18:in `resolve_metastore_uri'
ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:34:in `metastore'
ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:169:in `lookup'
ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'

I can confirm that redis-store is working for my fragment caches, and that the same URL is being used for that connection.

Here are the relevant lines from my environment file:

# config/environments/production.rb

config.cache_store = :redis_store, "redis://REDACTED_REDIS_HOST:6379/1", { expires_in: 120.minutes }

config.action_dispatch.rack_cache = {
  metastore:   "redis://REDACTED_REDIS_HOST:6379/1/metastore",
  entitystore: "file:/tmp/cache/entitystore"
}

Should this work, or have I missed something from the readme?

@freegenie
Copy link
Contributor

I confirm this is happening on master.

@freegenie
Copy link
Contributor

While redis-rack-cache can be used as a stand-alone rack middleware in any rack based application, Rails included, passing this configuration hash to action_dispatch.rack_cache tries to plug Redis::Store as a backend for Rack::Cache. This is currently not supported.

@jkrall
Copy link

jkrall commented Sep 5, 2013

Just ran into this... @freegenie I don't quite follow your comment. Are you saying the redis-rails README is not correct? Or that there's a bug on master?

@deevis
Copy link

deevis commented Sep 10, 2013

OK - so do we need to take the action_dispath.rack_cache configuration out of the redis-rails README? Do we need to manually configure the Rack::Cache in our own middleware stack? Some updates to the README or addressing this issue to have functionality consistent with the README would be greatly appreciated!

@jodosha
Copy link
Member

jodosha commented Sep 10, 2013

@deevis Which Rails version are you using? Because rack-cache has been removed from 4 ( http://rubygems.org/gems/actionpack/versions/4.0.0 vs http://rubygems.org/gems/actionpack/versions/3.2.14 ).

Anyway, feel free to open a pull request here https://github.com/redis-store/redis-rails

Thanks

@joe1chen
Copy link

You just need to add to your Gemfile

gem 'redis-rack-cache'

@Ingary
Copy link

Ingary commented Aug 6, 2014

Hi, I have the same problem described in this post.
I'm working with rails 4.0.1, ruby 2.0 and the latest versions of redis.

Basically I tried adding gems redis-rack-cache and rack-cache, but apparently the configuration is not detected.

The configuration I have tried is:

#environments/development.rb
config.action_dispatch.rack_cache = {
: verbose => true,
: MetaStore => 'redis :/ / 127.0.0.1:6379 / 0',
: entitystore => 'redis :/ / 127.0.0.1:6379 / 0'
}

I have also tried:

config.middleware.use Rack :: Cache,
: verbose => true,
: MetaStore => 'redis :/ / 127.0.0.1:6379 / 0',
: entitystore => 'redis :/ / 127.0.0.1:6379 / 0'

I always get a response like:
cache: [GET / api/home/10/1] miss

and revise redis indeed never saved anything.

I have set the configuration in development, because I would like to test. No if that creates problems.

Any idea what's happening? Any help will be highly appreciated.

@mmahalwy
Copy link

any update on this?

@radar
Copy link
Member

radar commented Jun 26, 2015

If there was it would be posted here.

On 27 Jun 2015, at 07:49, Mohamed El Mahallawy notifications@github.com wrote:

any update on this?


Reply to this email directly or view it on GitHub.

@tubbo tubbo closed this as completed Feb 4, 2016
@tubbo tubbo reopened this Feb 4, 2016
@tubbo
Copy link
Contributor

tubbo commented Feb 4, 2016

@Ingary your configuration is somewhat strange...it should be :metastore, not :MetaStore.

@tubbo tubbo closed this as completed Feb 4, 2016
@CaioBianchi
Copy link

I'm still experiencing the same issue with the :metastore provider.

@jfloff
Copy link

jfloff commented Jan 21, 2019

bump

@tubbo
Copy link
Contributor

tubbo commented Jan 22, 2019

@CaioBianchi @jfloff what version is installed (cat Gemfile.lock | grep redis-store)? also, can you paste your rack-cache config?

@helmiattastify
Copy link

helmiattastify commented Mar 10, 2022

@tubbo

config.action_dispatch.rack_cache = {
metastore: "redis://localhost:6379/1",
entitystore: "redis://localhost:6379/1",
verbose: true,
compress: true
# NOTE: :meta_store and :entity_store are also supported.
}

cache: [GET /api/users] miss

gem 'redis-rack-cache', github: "redis-store/redis-rack-cache"

when I remove that gem return pass

@jfloff
Copy link

jfloff commented Sep 11, 2023

I just got this error again 😅 . I have the latest version 1.10.0 installed and I'm running on Rails 6.

My configuration looks like this:

rack_cache = {
    metastore: ::Rack::Cache::MetaStore::Redis.new("#{ENV['REDIS_TLS_URL']}/1/metastore", ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }),
    entitystore: ::Rack::Cache::EntityStore::Redis.new("#{ENV['REDIS_TLS_URL']}/1/entitystore", ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }),
  }

@radar
Copy link
Member

radar commented Sep 11, 2023

@jfloff would you mind opening a new issue, as this one is quite old? And please show us how that rack_cache variable is being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests