The old `memcached_rb` name was not really descriptive. We can name the
native extension with the same name as the Gem and require it explicitly
in our initialization
A server's weight is now defined by an optional `/?weight` at the end of
the server string. This matches the official syntax in Memcached and
reduces ambiguities (e.g. in cases where you want to use a server
without specifying a port but specifying its weight).
The libmemcached APIs to add weighted servers to a client are not widely
available in all releases of libmemcached.
To work around this, we're now using the `memcached(const char*,
size_t)` API, which is recommended by the authors as the standard way to
initialize the client.
See: http://docs.libmemcached.org/libmemcached_configuration.html
The constructor for Memcached::Connection now takes a configuration
string. To keep the external API unchanged, Memcached::Client#new now
parses the array of servers and creates a configuration string that will
be passed to the connection.
Alternatively, you can pass directly a configuration string to
Client#new and that will be used in place of the array of servers.
A new static method Connection#check_config! has been added so we can
eagerly verify that user supplied config strings are valid.
All the complex C code for turning strings into the actual Memcached
behavior constants has been ported to Ruby. The resulting APIs should be
functionally equivalent, but now users have much more freedom when
setting and using behaviors.
The following calls are all now valid and equivalent:
conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, MEMCACHED_HASH_JENKINS)
conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 'MEMCACHED_HASH_JENKINS')
conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 'JENKINS')
conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 'jenkins')
conn.set_behavior(MEMCACHED_BEHAVIOR_HASH, 3)
conn.set_behavior('MEMCACHED_BEHAVIOR_HASH', 3)
conn.set_behavior('hash', 3)
# this should be the preferred usage
conn.set_behavior('hash', 'jenkins')