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

Add support for multiple redis connections #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SxDx
Copy link

@SxDx SxDx commented Jan 30, 2024

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 SxDx mentioned this pull request Jan 30, 2024
@SxDx
Copy link
Author

SxDx commented Feb 20, 2024

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?

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

Successfully merging this pull request may close these issues.

None yet

1 participant