Method: MemCachedSupportStore#initialize

Defined in:
lib/mem_cached_support_store.rb

#initialize(*addresses) ⇒ MemCachedSupportStore

Creates a new MemCacheStore object, with the given memcached server addresses. Each address is either a host name, or a host-with-port string in the form of “host_name:port”. For example:

ActiveSupport::Cache::MemCacheStore.new("localhost", "server-downstairs.localnetwork:8229")

If no addresses are specified, then MemCacheStore will connect to localhost port 11211 (the default memcached port).



27
28
29
30
31
32
33
34
35
36
# File 'lib/mem_cached_support_store.rb', line 27

def initialize(*addresses)
  addresses = addresses.flatten
  options = addresses.extract_options!
  options[:prefix_key] ||= options[:namespace]
  addresses = ["localhost"] if addresses.empty?
  @addresses = addresses
  @data = Memcached.new(addresses, options)

  extend ActiveSupport::Cache::Strategy::LocalCache
end