Skip to content

Support for ConnectionPool (with Dalli) #105

@ollie

Description

@ollie

Hello,

I think it would be a good idea to support the ConnectionPool (same author as Dalli) as the storage instance. I was pointed to this https://github.com/rtomayko/rack-cache/blob/master/lib/rack/cache/storage.rb#L41-L52 so I hacked around and added another if branch and it looks like it works. I had to try this on the 1.2 version because I was not getting any messages on the master branch. Would you like a pull request? It looks like this gem is has not been updated in a while though. :-(

Thanks.

# hack in support for passing a Dalli::Client or Memcached object
# as the storage URI.
case
when defined?(::Dalli) && uri.kind_of?(::Dalli::Client) ||
     defined?(::Dalli) && defined?(::ConnectionPool) && uri.kind_of?(::ConnectionPool)
  type.const_get(:Dalli).resolve(uri)
# ...
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions