modis icon indicating copy to clipboard operation
modis copied to clipboard

Add support for multiple redis connections

Open SxDx opened this issue 1 year ago • 1 comments

This PR adds support for more than one redis connection by providing multiple configurations to redis_options like this:

Modis.redis_options = {
  default: { url: 'redis://localhost:6379/0' },
  custom: { url: 'redis://localhost:6379/1' }
}

while still being backwards compatible to the old configuration style

Modis.redis_options = {
 url: 'redis://localhost:6379/0
}

You can then select which connection to use on a per model basis

class User
  include Modis::Model
  self.modis_connection = :custom

  attribute :name, :string
end

If you have any ideas on how to improve the tests I am more than happy to change them.

SxDx avatar Jan 30 '24 14:01 SxDx

Hey @ileitch and @aried3r 👋 , We would really love this feature for our app. Is there a chance that you could take a look at this, or should we look at forking the project?

SxDx avatar Feb 20 '24 15:02 SxDx

Hey @benlangfeld! Great that you picked this up :) Is there anything we can do to help get this merged?

otherguy avatar Jul 31 '24 13:07 otherguy