lib/dalli/client.rb
##
# Dalli::Client is the main class which developers will use to interact with
# the memcached server.  Usage:
#
#   Dalli::Client.new(['localhost:11211:10', 'cache-2.example.com:11211:5', '192.168.0.1:22122:5', '/var/run/memcached/socket'],
#                   :threadsafe => true, :failover => true, :expires_in => 300)
#
# servers is an Array of "host:port:weight" where weight allows you to distribute cache unevenly.
# Both weight and port are optional.  If you pass in nil, Dalli will use the <tt>MEMCACHE_SERVERS</tt>
# environment variable or default to 'localhost:11211' if it is not present.  Dalli also supports
# the ability to connect to Memcached on localhost through a UNIX socket.  To use this functionality,
# use a full pathname (beginning with a slash character '/') in place of the "host:port" pair in
# the server configuration.
#
# Options:
# - :namespace - prepend each key with this value to provide simple namespacing.
# - :failover - if a server is down, look for and store values on another server in the ring.  Default: true.
# - :threadsafe - ensure that only one thread is actively using a socket at a time. Default: true.
# - :expires_in - default TTL in seconds if you do not pass TTL as a parameter to an individual operation, defaults to 0 or forever
# - :compress - defaults to false, if true Dalli will compress values larger than 1024 bytes before sending them to memcached.
# - :serializer - defaults to Marshal
# - :compressor - defaults to zlib
# - :cache_nils - defaults to false, if true Dalli will not treat cached nil values as 'not found' for #fetch operations.
# - :digest_class - defaults to Digest::MD5, allows you to pass in an object that responds to the hexdigest method, useful for injecting a FIPS compliant hash object.
#
:Client is the main class which developers will use to interact with
the memcached server.  Usage.



servers is an Array of "host:port:weight" where weight allows you to distribute cache unevenly.
Both weight and port are optional.  If you pass in nil, Dalli will use the MEMCACHE_SERVERS
environment variable or default to 'localhost:11211' if it is not present.  Dalli also supports
the ability to connect to Memcached on localhost through a UNIX socket.  To use this functionality,
use a full pathname (beginning with a slash character '/') in place of the "host:port" pair in
the server configuration.

:namespace - prepend each key with this value to provide simple namespacing.
:failover - if a server is down, look for and store values on another server in the ring.  Default: true.
:threadsafe - ensure that only one thread is actively using a socket at a time. Default: true.
:expires_in - default TTL in seconds if you do not pass TTL as a parameter to an individual operation, defaults to 0 or forever
:compress - defaults to false, if true Dalli will compress values larger than 1024 bytes before sending them to memcached.
:serializer - defaults to Marshal
:compressor - defaults to zlib
:cache_nils - defaults to false, if true Dalli will not treat cached nil values as 'not found' for #fetch operations.
:digest_class - defaults to Digest::MD5, allows you to pass in an object that responds to the hexdigest method, useful for injecting a FIPS compliant hash object.
: Client is the main class which developers will use to interact with the memcached server . Usage . servers is an Array of " host : port : weight " where weight allows you to distribute cache unevenly . Both weight and port are optional . If you pass in nil Dalli will use the MEMCACHE_SERVERS environment variable or default to ' localhost : 11211 ' if it is not present . Dalli also supports the ability to connect to Memcached on localhost through a UNIX socket . To use this functionality use a full pathname ( beginning with a slash character ' / ' ) in place of the " host : port " pair in the server configuration . : namespace - prepend each key with this value to provide simple namespacing . : failover - if a server is down look for and store values on another server in the ring . Default : true . : threadsafe - ensure that only one thread is actively using a socket at a time . Default : true . : expires_in - default TTL in seconds if you do not pass TTL as a parameter to an individual operation defaults to 0 or forever : compress - defaults to false if true Dalli will compress values larger than 1024 bytes before sending them to memcached . : serializer - defaults to Marshal : compressor - defaults to zlib : cache_nils - defaults to false if true Dalli will not treat cached nil values as ' not found ' for #fetch operations . : digest_class - defaults to Digest :: MD5 allows you to pass in an object that responds to the hexdigest method useful for injecting a FIPS compliant hash object .
def normalize_options(opts)
      if opts[:compression]
        Dalli.logger.warn "DEPRECATED: Dalli's :compression option is now just :compress => true.  Please update your configuration."
        opts[:compress] = opts.delete(:compression)
      end
      begin
        opts[:expires_in] = opts[:expires_in].to_i if opts[:expires_in]
      rescue NoMethodError
        raise ArgumentError, "cannot convert :expires_in => #{opts[:expires_in].inspect} to an integer"
      end
      if opts[:digest_class] && !opts[:digest_class].respond_to?(:hexdigest)
        raise ArgumentError, "The digest_class object must respond to the hexdigest method"
      end
      opts
    end
def normalize_options ( opts ) if opts [ :compression ] Dalli . logger . warn "DEPRECATED: Dalli's :compression option is now just :compress => true.  Please update your configuration." opts [ :compress ] = opts . delete ( :compression ) end begin opts [ :expires_in ] = opts [ :expires_in ] . to_i if opts [ :expires_in ] rescue NoMethodError raise ArgumentError , "cannot convert :expires_in => #{opts[:expires_in].inspect} to an integer" end if opts [ :digest_class ] && ! opts [ :digest_class ] . respond_to? ( :hexdigest ) raise ArgumentError , "The digest_class object must respond to the hexdigest method" end opts end
Dalli::Client is the main class which developers will use to interact with
the memcached server.
Dalli :: Client is the main class which developers will use to interact with the memcached server .
opts
<not_specific>