Sha256: ed590f9a2d85c057dc5815d7a11ff3d0b171c3924b8a17c24348b9ff8febde24

Contents?: true

Size: 593 Bytes

Versions: 1

Compression:

Stored size: 593 Bytes

Contents

require 'memcached'

class MemcacheAuth < Memcached
  def initialize(servers = nil, opts = {})
    if !servers && ENV['MEMCACHE_SERVERS']
      servers = ENV['MEMCACHE_SERVERS'].split(',')
    end
    super(servers, opts)
  end
end

class MemcacheAuth::Rails < Memcached::Rails
  def initialize(*args)
    opts = args.last.is_a?(Hash) ? args.pop : {}
    servers = Array(
      args.any? ? args.unshift : opts.delete(:servers)
    ).flatten.compact

    if servers.empty? && ENV['MEMCACHE_SERVERS']
      servers = ENV['MEMCACHE_SERVERS'].split(',')
    end
    super(servers, opts)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
memcache-auth-0.2.5 lib/memcacheauth.rb