Граф коммитов

415 Коммитов

Автор SHA1 Сообщение Дата
Vicent Marti a0df206974 client: Let libmemcached pick the defaults
The library instantiates new connections with a sane set of default
already. We don't need to specify them from Ruby.
2016-03-17 09:38:07 +01:00
Vicent Marti 7cc8a95610 connection: Use `mget_execute` when in binary mode
The performance of `mget_execute` should be faster, but this API is only
available if the connection is in binary mode.
2016-03-16 15:48:54 +01:00
Vicent Marti 094d2904e7 ext: rename the native extension to `memcached`
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
2016-03-16 15:05:58 +01:00
Vicent Marti 4fff883508 server: print with Memcached's standard syntax 2016-03-16 14:49:34 +01:00
Vicent Marti f534ae435f server: Do not modify hostname when printing
The `<<` operator would modify the original hostname string for the
server when calling Server#to_s.
2016-03-16 14:48:42 +01:00
Vicent Marti 0544f5ea56 client: Use Memcached's default syntax for weight
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).
2016-03-16 14:46:43 +01:00
Vicent Marti d2496275f5 client: Initialize using a config string
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.
2016-03-16 11:49:33 +01:00
Vicent Marti e1a162c131 behavior: move most of the behavior parsing code to Ruby
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')
2016-03-16 11:45:48 +01:00
Vicent Marti 2608d41e3a Fix Ruby warnings
Miscellaneous warnings regarding Ruby syntax (shown in Ruby 2.1+)
2016-03-16 11:42:48 +01:00
Arthur Neves c9fdb406ea Make sure we dont connect on client new 2016-03-15 20:19:47 -04:00
Arthur Neves ec0cb5d856 Add reset method 2016-03-15 20:12:59 -04:00
Arthur Neves 50d8171db8 Add touch method 2016-03-15 18:48:38 -04:00
Arthur Neves 726ffba7de Remove commented out code 2016-03-15 18:32:33 -04:00
Arthur Neves 848723e20d Merge branch 'vmg/cleanup' 2016-03-15 17:50:39 -04:00
Arthur Neves 84bfd38f21 fix Server to_s method 2016-03-15 17:05:29 -04:00
Arthur Neves 0eaa496264 hostname instead of name on server 2016-03-15 16:47:26 -04:00
Arthur Neves 115b89073f require client after the lib 2016-03-15 16:44:55 -04:00
Vicent Marti e8b309d555 Cleanup! 2016-03-15 18:29:23 +01:00
Arthur Neves 0f0aaf3b19 Add clone method 2016-03-14 22:27:51 -04:00
Arthur Neves 6a594a8cd2 Remove some client prefix code 2016-03-14 00:11:42 -04:00
Arthur Neves e63dabc188 Handle prefix key on connection 2016-03-14 00:10:10 -04:00
Arthur Neves eda665cfe4 Add more options 2016-03-13 23:25:54 -04:00
Arthur Neves d9b9b5991d Add some defaults 2016-03-12 00:28:04 -05:00
Arthur Neves 8cd114cb59 Fix conversion value on behavior 2016-03-11 23:13:57 -05:00
Arthur Neves 005e555f07 Show warning for deprecated behaviors 2016-03-11 23:13:44 -05:00
Arthur Neves f6d113852a fix bad server argument 2016-03-11 17:29:36 -05:00
Arthur Neves b1c465fde8 Fix default ttl and fetch prefix key 2016-03-11 17:07:21 -05:00
Arthur Neves d8c2f6b318 Extract options on client 2016-03-11 16:32:20 -05:00
Arthur Neves 60c8ccea8a Allow one server as string 2016-03-11 16:32:06 -05:00
Arthur Neves f7b7c37e8e Move behavior module 2016-03-11 12:45:16 -05:00
Arthur Neves 7a2414f2cf Handle bad bahavior configs 2016-03-11 12:42:22 -05:00
Arthur Neves 49f7c8a9c2 Add conversions to behaviors 2016-03-11 12:34:49 -05:00
Arthur Neves e928573866 set behaviors instead of printing them 2016-03-11 12:00:22 -05:00
Arthur Neves c294a5cfe7 Add basic behavior API 2016-03-11 11:41:13 -05:00
Arthur Neves cfbb42323a remove Taj namespace 2016-03-09 08:54:59 -05:00
Arthur Neves a2f4af7d7f Rename extension to memcached_rb 2016-03-09 08:52:49 -05:00
Arthur Neves 32d64486ab Error handleing 2016-03-08 23:50:43 -05:00
Arthur Neves b80aafacf7 Prepend and append methods 2016-03-06 22:07:38 -05:00
Arthur Neves 7e1e8d06bb Replace method 2016-03-06 21:02:26 -05:00
Arthur Neves a0ce21ae3f Exist method 2016-03-06 20:55:54 -05:00
Arthur Neves 6d2ebab6ad add inc and dec methods 2016-03-05 18:45:23 -05:00
Arthur Neves 7b38c9934b move client code 2016-03-05 17:08:56 -05:00
Arthur Neves b7b84e50df add method 2016-03-05 17:03:47 -05:00
Arthur Neves da022d191e Add delete 2016-03-05 16:48:39 -05:00
Arthur Neves 49b7e3ec1c Add default ttl 2016-03-05 15:03:18 -05:00
Arthur Neves 74608211a9 Add ttl and flags to SET 2016-03-05 14:33:31 -05:00
Arthur Neves 65e8a725cb Get/Set raw
Now we will use raw instead of encode/decode
2016-03-05 14:22:15 -05:00
Arthur Neves 83c0851fe2 Flush method 2016-03-05 12:06:10 -05:00
Arthur Neves 49323421d6 Basic get_multi 2016-03-05 11:55:18 -05:00
Arthur Neves 11f32b5a6d Handle get miss 2016-03-04 18:22:54 -05:00