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

Cache? #7

Closed
atomless opened this issue Oct 5, 2016 · 2 comments
Closed

Cache? #7

atomless opened this issue Oct 5, 2016 · 2 comments

Comments

@atomless
Copy link

atomless commented Oct 5, 2016

Hi, I'm look into how to get activerecord query cache working otr.
After adding this to my config.ru:

use ActiveRecord::QueryCache

On starting my server I now see this error :

/Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:86:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError)
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:86:in `new'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:86:in `block in use'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:147:in `block in to_app'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:147:in `each'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:147:in `inject'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:147:in `to_app'
    from /Users/jamestindall/Documents/doc_baton/BatonSite/dist/config.ru:32:in `<main>'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/server.rb:272:in `start'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/lib/rack/server.rb:147:in `start'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/bin/rackup:22:in `load'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/bin/rackup:22:in `<main>'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
    from /Users/jamestindall/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

Any ideas? Have you had activerecord query cache working otr?

@atomless
Copy link
Author

atomless commented Oct 5, 2016

I found one solution is to add this after a connection has been established:

ActiveRecord::Base.connection.enable_query_cache!

But wonder if there's a better way ?

@jhollinger
Copy link
Owner

The recommended answer is use OTR::ActiveRecord::QueryCache,

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

2 participants