memcache 1.2.10 → 1.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/ext/extconf.rb +2 -1
- data/ext/native_server.c +14 -11
- data/memcache.gemspec +2 -2
- metadata +2 -2
data/VERSION.yml
CHANGED
data/ext/extconf.rb
CHANGED
data/ext/native_server.c
CHANGED
@@ -54,7 +54,6 @@ static VALUE mc_alloc(VALUE klass) {
|
|
54
54
|
}
|
55
55
|
|
56
56
|
static VALUE throw_error(memcached_return_t *error) {
|
57
|
-
memcached_st *mc;
|
58
57
|
switch(*error) {
|
59
58
|
case MEMCACHED_SERVER_ERROR: rb_raise(cMemcacheServerError, "Server error");
|
60
59
|
case MEMCACHED_CLIENT_ERROR: rb_raise(cMemcacheClientError, "Client error");
|
@@ -63,7 +62,7 @@ static VALUE throw_error(memcached_return_t *error) {
|
|
63
62
|
case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE:
|
64
63
|
rb_raise(cMemcacheConnectionError, "Connection error");
|
65
64
|
default:
|
66
|
-
rb_raise(cMemcacheError, "Memcache error: %s", memcached_strerror(
|
65
|
+
rb_raise(cMemcacheError, "Memcache error: %s", memcached_strerror(NULL, *error));
|
67
66
|
}
|
68
67
|
return Qnil;
|
69
68
|
}
|
@@ -242,7 +241,7 @@ static bool use_binary(memcached_st* mc) {
|
|
242
241
|
|
243
242
|
static VALUE mc_get(int argc, VALUE *argv, VALUE self) {
|
244
243
|
memcached_st *mc;
|
245
|
-
VALUE cas, keys, results, key,
|
244
|
+
VALUE cas, keys, results, key, value;
|
246
245
|
VALUE scalar_key = Qnil;
|
247
246
|
memcached_return status;
|
248
247
|
|
@@ -271,6 +270,7 @@ static VALUE mc_get(int argc, VALUE *argv, VALUE self) {
|
|
271
270
|
return value;
|
272
271
|
} else {
|
273
272
|
printf("Memcache read error: %s %u\n", memcached_strerror(mc, status), status);
|
273
|
+
return Qnil;
|
274
274
|
}
|
275
275
|
} else {
|
276
276
|
memcached_result_st* result;
|
@@ -372,19 +372,20 @@ VALUE mc_incr(int argc, VALUE *argv, VALUE self) {
|
|
372
372
|
memcached_st *mc;
|
373
373
|
VALUE key, amount;
|
374
374
|
static memcached_return_t result;
|
375
|
-
|
375
|
+
unsigned int offset;
|
376
|
+
uint64_t value;
|
376
377
|
|
377
378
|
Data_Get_Struct(self, memcached_st, mc);
|
378
379
|
rb_scan_args(argc, argv, "11", &key, &amount);
|
379
380
|
|
380
381
|
key = StringValue(key);
|
381
382
|
if (!use_binary(mc)) key = escape_key(key, NULL);
|
382
|
-
|
383
|
+
offset = RTEST(amount) ? NUM2INT(amount) : 1;
|
383
384
|
|
384
|
-
result = memcached_increment(mc, RSTRING_PTR(key), RSTRING_LEN(key),
|
385
|
+
result = memcached_increment(mc, RSTRING_PTR(key), RSTRING_LEN(key), offset, &value);
|
385
386
|
|
386
387
|
if (result == MEMCACHED_SUCCESS) {
|
387
|
-
return LONG2NUM(
|
388
|
+
return LONG2NUM(value);
|
388
389
|
} else if (result == MEMCACHED_NOTFOUND) {
|
389
390
|
return Qnil;
|
390
391
|
} else {
|
@@ -396,19 +397,20 @@ VALUE mc_decr(int argc, VALUE *argv, VALUE self) {
|
|
396
397
|
memcached_st *mc;
|
397
398
|
VALUE key, amount;
|
398
399
|
static memcached_return_t result;
|
399
|
-
|
400
|
+
unsigned int offset;
|
401
|
+
uint64_t value;
|
400
402
|
|
401
403
|
Data_Get_Struct(self, memcached_st, mc);
|
402
404
|
rb_scan_args(argc, argv, "11", &key, &amount);
|
403
405
|
|
404
406
|
key = StringValue(key);
|
405
407
|
if (!use_binary(mc)) key = escape_key(key, NULL);
|
406
|
-
|
408
|
+
offset = RTEST(amount) ? NUM2INT(amount) : 1;
|
407
409
|
|
408
|
-
result = memcached_decrement(mc, RSTRING_PTR(key), RSTRING_LEN(key),
|
410
|
+
result = memcached_decrement(mc, RSTRING_PTR(key), RSTRING_LEN(key), offset, &value);
|
409
411
|
|
410
412
|
if (result == MEMCACHED_SUCCESS) {
|
411
|
-
return LONG2NUM(
|
413
|
+
return LONG2NUM(value);
|
412
414
|
} else if (result == MEMCACHED_NOTFOUND) {
|
413
415
|
return Qnil;
|
414
416
|
} else {
|
@@ -573,6 +575,7 @@ VALUE mc_close(VALUE self) {
|
|
573
575
|
memcached_st *mc;
|
574
576
|
Data_Get_Struct(self, memcached_st, mc);
|
575
577
|
memcached_quit(mc);
|
578
|
+
return Qnil;
|
576
579
|
}
|
577
580
|
|
578
581
|
void Init_native_server() {
|
data/memcache.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{memcache}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Balthrop"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-15}
|
13
13
|
s.description = %q{Ruby client for memcached supporting advanced protocol features and pluggable architecture.}
|
14
14
|
s.email = %q{code@justinbalthrop.com}
|
15
15
|
s.extensions = ["ext/extconf.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memcache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Balthrop
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-04-
|
12
|
+
date: 2010-04-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|