Coder Social home page Coder Social logo

Comments (4)

sorentwo avatar sorentwo commented on June 14, 2024

Readthis already uses connection_pool to manage a pool of redis connections. You can access to the pool directly, as documented in the README:

Rails.cache.pool.with do |conn|
  conn.geoadd($DRIVER_LOCATIONS, latitude, longitude, id)
end

You can configure the pool_size and the pool_timeout directly in your cache_store setup:

config.cache_store = :readthis_store, { 
  expires_in: 1.minutes.to_i,
  namespace: 'cache',
  pool_size: 10,
  redis: { url: 'redis://localhost:6379/15', driver: :hiredis }
}

from readthis.

ViTVetal avatar ViTVetal commented on June 14, 2024

@sorentwo So there is no matter that I also use Redis in application for non cache related things (geoadd etc) and Redis will use same db for cache and for other things (as you can see for pool I used db №15 and for cache №1). Right?

from readthis.

sorentwo avatar sorentwo commented on June 14, 2024

No, so long as all of the data is ephemeral there isn't any problem with doing that. I've written about this a bit in the past: https://sorentwo.com/2015/07/27/optimizing-redis-usage-for-caching.html

from readthis.

ViTVetal avatar ViTVetal commented on June 14, 2024

@sorentwo Thanks! But in Rails 5+ applications Action Cable uses Redis as adapter for production:

#config/cable.yml

development:
  adapter: async

test:
  adapter: async

production:
  adapter: redis
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
  channel_prefix: app_production

Is there any way to provide the pool?

from readthis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.