Sha256: 58b2a8657e2d1bf4939910a1e519c15abf1bde4ac09d5fb05ca070373d21d132

Contents?: true

Size: 498 Bytes

Versions: 14

Compression:

Stored size: 498 Bytes

Contents

class RedisConnection

  @@redis_connections = {}

  def initialize(options={})
    key = options.keys.sort.map{|k| "#{k}:#{options[k]}"}.join(",")
    unless @@redis_connections.has_key?(key)
      @@redis_connections[key] = Redis.new(options)
    end
    @current_connection = @@redis_connections[key]
    @current_connection
  end

  def method_missing(m, *args, &block)
    if @current_connection.respond_to?(m)
      @current_connection.send(m, *args)
    else
      super
    end
  end


end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cobweb-1.2.1 lib/redis_connection.rb
cobweb-1.2.0 lib/redis_connection.rb
cobweb-1.1.0 lib/redis_connection.rb
cobweb-1.0.29 lib/redis_connection.rb
cobweb-1.0.28 lib/redis_connection.rb
cobweb-1.0.27 lib/redis_connection.rb
cobweb-1.0.26 lib/redis_connection.rb
cobweb-1.0.25 lib/redis_connection.rb
cobweb-1.0.24 lib/redis_connection.rb
cobweb-1.0.23 lib/redis_connection.rb
cobweb-1.0.22 lib/redis_connection.rb
cobweb-1.0.21 lib/redis_connection.rb
cobweb-1.0.20 lib/redis_connection.rb
cobweb-1.0.19 lib/redis_connection.rb