memcached 0.19.10 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@
23
23
 
24
24
  %apply unsigned short { uint8_t };
25
25
  %apply unsigned int { uint16_t };
26
+ %apply unsigned int { uint32_t user_spec_len };
26
27
  %apply unsigned long { uint32_t flags, uint32_t offset, uint32_t weight };
27
28
  %apply unsigned long long { uint64_t data, uint64_t cas };
28
29
 
@@ -149,12 +150,12 @@
149
150
 
150
151
  //// Manual wrappers
151
152
 
152
- // Single get. SWIG likes to use SWIG_FromCharPtr instead of SWIG_FromCharPtrAndSize because
153
- // of the retval/argout split, so it truncates return values with \0 in them.
153
+ // Single get. SWIG likes to use SWIG_FromCharPtr instead of SWIG_FromCharPtrAndSize because
154
+ // of the retval/argout split, so it truncates return values with \0 in them.
154
155
  VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error);
155
156
  %{
156
157
  VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
157
- VALUE ret;
158
+ VALUE ret;
158
159
  size_t value_length;
159
160
  char *value = memcached_get(ptr, key, key_length, &value_length, flags, error);
160
161
  ret = rb_str_new(value, value_length);
@@ -163,10 +164,22 @@ VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length
163
164
  };
164
165
  %}
165
166
 
167
+ VALUE memcached_get_len_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t user_spec_len, uint32_t *flags, memcached_return *error);
168
+ %{
169
+ VALUE memcached_get_len_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t user_spec_len, uint32_t *flags, memcached_return *error) {
170
+ VALUE ret;
171
+ size_t value_length;
172
+ char *value = memcached_get_len(ptr, key, key_length, user_spec_len, &value_length, flags, error);
173
+ ret = rb_str_new(value, value_length);
174
+ free(value);
175
+ return ret;
176
+ };
177
+ %}
178
+
166
179
  VALUE memcached_get_from_last_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error);
167
180
  %{
168
181
  VALUE memcached_get_from_last_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
169
- VALUE ret;
182
+ VALUE ret;
170
183
  size_t value_length;
171
184
  char *value = memcached_get_from_last(ptr, key, key_length, &value_length, flags, error);
172
185
  ret = rb_str_new(value, value_length);
@@ -2251,7 +2251,7 @@ SWIG_From_unsigned_SS_int (unsigned int value)
2251
2251
 
2252
2252
 
2253
2253
  VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
2254
- VALUE ret;
2254
+ VALUE ret;
2255
2255
  size_t value_length;
2256
2256
  char *value = memcached_get(ptr, key, key_length, &value_length, flags, error);
2257
2257
  ret = rb_str_new(value, value_length);
@@ -2260,8 +2260,18 @@ VALUE memcached_get_rvalue(memcached_st *ptr, const char *key, size_t key_length
2260
2260
  };
2261
2261
 
2262
2262
 
2263
+ VALUE memcached_get_len_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t user_spec_len, uint32_t *flags, memcached_return *error) {
2264
+ VALUE ret;
2265
+ size_t value_length;
2266
+ char *value = memcached_get_len(ptr, key, key_length, user_spec_len, &value_length, flags, error);
2267
+ ret = rb_str_new(value, value_length);
2268
+ free(value);
2269
+ return ret;
2270
+ };
2271
+
2272
+
2263
2273
  VALUE memcached_get_from_last_rvalue(memcached_st *ptr, const char *key, size_t key_length, uint32_t *flags, memcached_return *error) {
2264
- VALUE ret;
2274
+ VALUE ret;
2265
2275
  size_t value_length;
2266
2276
  char *value = memcached_get_from_last(ptr, key, key_length, &value_length, flags, error);
2267
2277
  ret = rb_str_new(value, value_length);
@@ -8735,6 +8745,74 @@ fail:
8735
8745
  }
8736
8746
 
8737
8747
 
8748
+ SWIGINTERN VALUE
8749
+ _wrap_memcached_get_len(int argc, VALUE *argv, VALUE self) {
8750
+ memcached_st *arg1 = (memcached_st *) 0 ;
8751
+ char *arg2 = (char *) 0 ;
8752
+ size_t arg3 ;
8753
+ uint32_t arg4 ;
8754
+ size_t *arg5 = (size_t *) 0 ;
8755
+ uint32_t *arg6 = (uint32_t *) 0 ;
8756
+ memcached_return *arg7 = (memcached_return *) 0 ;
8757
+ void *argp1 = 0 ;
8758
+ int res1 = 0 ;
8759
+ unsigned int val4 ;
8760
+ int ecode4 = 0 ;
8761
+ size_t temp5 ;
8762
+ int res5 = SWIG_TMPOBJ ;
8763
+ uint32_t temp6 ;
8764
+ int res6 = SWIG_TMPOBJ ;
8765
+ memcached_return temp7 ;
8766
+ int res7 = SWIG_TMPOBJ ;
8767
+ char *result = 0 ;
8768
+ VALUE vresult = Qnil;
8769
+
8770
+ arg5 = &temp5;
8771
+ arg6 = &temp6;
8772
+ arg7 = &temp7;
8773
+ if ((argc < 3) || (argc > 3)) {
8774
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
8775
+ }
8776
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
8777
+ if (!SWIG_IsOK(res1)) {
8778
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "memcached_st *","memcached_get_len", 1, argv[0] ));
8779
+ }
8780
+ arg1 = (memcached_st *)(argp1);
8781
+ {
8782
+ arg2 = StringValuePtr(argv[1]);
8783
+ arg3 = (size_t) RSTRING_LEN(argv[1]);
8784
+ }
8785
+ ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
8786
+ if (!SWIG_IsOK(ecode4)) {
8787
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "uint32_t","memcached_get_len", 4, argv[2] ));
8788
+ }
8789
+ arg4 = (uint32_t)(val4);
8790
+ result = (char *)memcached_get_len(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
8791
+ vresult = SWIG_FromCharPtr((const char *)result);
8792
+ if (SWIG_IsTmpObj(res5)) {
8793
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_size_t((*arg5)));
8794
+ } else {
8795
+ int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8796
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_size_t, new_flags));
8797
+ }
8798
+ if (SWIG_IsTmpObj(res6)) {
8799
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_int((*arg6)));
8800
+ } else {
8801
+ int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8802
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_uint32_t, new_flags));
8803
+ }
8804
+ if (SWIG_IsTmpObj(res7)) {
8805
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg7)));
8806
+ } else {
8807
+ int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8808
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_memcached_return, new_flags));
8809
+ }
8810
+ return vresult;
8811
+ fail:
8812
+ return Qnil;
8813
+ }
8814
+
8815
+
8738
8816
  SWIGINTERN VALUE
8739
8817
  _wrap_memcached_mget(int argc, VALUE *argv, VALUE self) {
8740
8818
  memcached_st *arg1 = (memcached_st *) 0 ;
@@ -8774,6 +8852,53 @@ fail:
8774
8852
  }
8775
8853
 
8776
8854
 
8855
+ SWIGINTERN VALUE
8856
+ _wrap_memcached_mget_len(int argc, VALUE *argv, VALUE self) {
8857
+ memcached_st *arg1 = (memcached_st *) 0 ;
8858
+ char **arg2 = (char **) 0 ;
8859
+ size_t *arg3 = (size_t *) 0 ;
8860
+ size_t arg4 ;
8861
+ uint32_t arg5 ;
8862
+ void *argp1 = 0 ;
8863
+ int res1 = 0 ;
8864
+ unsigned int val5 ;
8865
+ int ecode5 = 0 ;
8866
+ memcached_return result;
8867
+ VALUE vresult = Qnil;
8868
+
8869
+ if ((argc < 3) || (argc > 3)) {
8870
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
8871
+ }
8872
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
8873
+ if (!SWIG_IsOK(res1)) {
8874
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "memcached_st *","memcached_mget_len", 1, argv[0] ));
8875
+ }
8876
+ arg1 = (memcached_st *)(argp1);
8877
+ {
8878
+ int i;
8879
+ Check_Type(argv[1], T_ARRAY);
8880
+ arg4 = (unsigned int) RARRAY_LEN(argv[1]);
8881
+ arg3 = (size_t *) malloc((arg4+1)*sizeof(size_t));
8882
+ arg2 = (char **) malloc((arg4+1)*sizeof(char *));
8883
+ for(i = 0; i < arg4; i ++) {
8884
+ Check_Type(RARRAY_PTR(argv[1])[i], T_STRING);
8885
+ arg3[i] = RSTRING_LEN(RARRAY_PTR(argv[1])[i]);
8886
+ arg2[i] = StringValuePtr(RARRAY_PTR(argv[1])[i]);
8887
+ }
8888
+ }
8889
+ ecode5 = SWIG_AsVal_unsigned_SS_int(argv[2], &val5);
8890
+ if (!SWIG_IsOK(ecode5)) {
8891
+ SWIG_exception_fail(SWIG_ArgError(ecode5), Ruby_Format_TypeError( "", "uint32_t","memcached_mget_len", 5, argv[2] ));
8892
+ }
8893
+ arg5 = (uint32_t)(val5);
8894
+ result = (memcached_return)memcached_mget_len(arg1,(char const **)arg2,arg3,arg4,arg5);
8895
+ vresult = SWIG_From_int((int)(result));
8896
+ return vresult;
8897
+ fail:
8898
+ return Qnil;
8899
+ }
8900
+
8901
+
8777
8902
  SWIGINTERN VALUE
8778
8903
  _wrap_memcached_get_by_key(int argc, VALUE *argv, VALUE self) {
8779
8904
  memcached_st *arg1 = (memcached_st *) 0 ;
@@ -8781,25 +8906,28 @@ _wrap_memcached_get_by_key(int argc, VALUE *argv, VALUE self) {
8781
8906
  size_t arg3 ;
8782
8907
  char *arg4 = (char *) 0 ;
8783
8908
  size_t arg5 ;
8784
- size_t *arg6 = (size_t *) 0 ;
8785
- uint32_t *arg7 = (uint32_t *) 0 ;
8786
- memcached_return *arg8 = (memcached_return *) 0 ;
8909
+ uint32_t arg6 ;
8910
+ size_t *arg7 = (size_t *) 0 ;
8911
+ uint32_t *arg8 = (uint32_t *) 0 ;
8912
+ memcached_return *arg9 = (memcached_return *) 0 ;
8787
8913
  void *argp1 = 0 ;
8788
8914
  int res1 = 0 ;
8789
- size_t temp6 ;
8790
- int res6 = SWIG_TMPOBJ ;
8791
- uint32_t temp7 ;
8915
+ unsigned int val6 ;
8916
+ int ecode6 = 0 ;
8917
+ size_t temp7 ;
8792
8918
  int res7 = SWIG_TMPOBJ ;
8793
- memcached_return temp8 ;
8919
+ uint32_t temp8 ;
8794
8920
  int res8 = SWIG_TMPOBJ ;
8921
+ memcached_return temp9 ;
8922
+ int res9 = SWIG_TMPOBJ ;
8795
8923
  char *result = 0 ;
8796
8924
  VALUE vresult = Qnil;
8797
8925
 
8798
- arg6 = &temp6;
8799
8926
  arg7 = &temp7;
8800
8927
  arg8 = &temp8;
8801
- if ((argc < 2) || (argc > 2)) {
8802
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
8928
+ arg9 = &temp9;
8929
+ if ((argc < 3) || (argc > 3)) {
8930
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
8803
8931
  }
8804
8932
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
8805
8933
  if (!SWIG_IsOK(res1)) {
@@ -8810,25 +8938,30 @@ _wrap_memcached_get_by_key(int argc, VALUE *argv, VALUE self) {
8810
8938
  arg4 = arg2 = StringValuePtr(argv[1]);
8811
8939
  arg5 = arg3 = (size_t) RSTRING_LEN(argv[1]);
8812
8940
  }
8813
- result = (char *)memcached_get_by_key(arg1,(char const *)arg2,arg3,(char const *)arg4,arg5,arg6,arg7,arg8);
8941
+ ecode6 = SWIG_AsVal_unsigned_SS_int(argv[2], &val6);
8942
+ if (!SWIG_IsOK(ecode6)) {
8943
+ SWIG_exception_fail(SWIG_ArgError(ecode6), Ruby_Format_TypeError( "", "uint32_t","memcached_get_by_key", 6, argv[2] ));
8944
+ }
8945
+ arg6 = (uint32_t)(val6);
8946
+ result = (char *)memcached_get_by_key(arg1,(char const *)arg2,arg3,(char const *)arg4,arg5,arg6,arg7,arg8,arg9);
8814
8947
  vresult = SWIG_FromCharPtr((const char *)result);
8815
- if (SWIG_IsTmpObj(res6)) {
8816
- vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_size_t((*arg6)));
8817
- } else {
8818
- int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8819
- vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_size_t, new_flags));
8820
- }
8821
8948
  if (SWIG_IsTmpObj(res7)) {
8822
- vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_int((*arg7)));
8949
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_size_t((*arg7)));
8823
8950
  } else {
8824
8951
  int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8825
- vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_uint32_t, new_flags));
8952
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_size_t, new_flags));
8826
8953
  }
8827
8954
  if (SWIG_IsTmpObj(res8)) {
8828
- vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg8)));
8955
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_int((*arg8)));
8829
8956
  } else {
8830
8957
  int new_flags = SWIG_IsNewObj(res8) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8831
- vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg8), SWIGTYPE_p_memcached_return, new_flags));
8958
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg8), SWIGTYPE_p_uint32_t, new_flags));
8959
+ }
8960
+ if (SWIG_IsTmpObj(res9)) {
8961
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg9)));
8962
+ } else {
8963
+ int new_flags = SWIG_IsNewObj(res9) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
8964
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg9), SWIGTYPE_p_memcached_return, new_flags));
8832
8965
  }
8833
8966
  return vresult;
8834
8967
  fail:
@@ -8844,6 +8977,7 @@ _wrap_memcached_mget_by_key(int argc, VALUE *argv, VALUE self) {
8844
8977
  char **arg4 = (char **) 0 ;
8845
8978
  size_t *arg5 = (size_t *) 0 ;
8846
8979
  size_t arg6 ;
8980
+ uint32_t arg7 ;
8847
8981
  void *argp1 = 0 ;
8848
8982
  int res1 = 0 ;
8849
8983
  int res2 ;
@@ -8851,11 +8985,13 @@ _wrap_memcached_mget_by_key(int argc, VALUE *argv, VALUE self) {
8851
8985
  int alloc2 = 0 ;
8852
8986
  size_t val3 ;
8853
8987
  int ecode3 = 0 ;
8988
+ unsigned int val7 ;
8989
+ int ecode7 = 0 ;
8854
8990
  memcached_return result;
8855
8991
  VALUE vresult = Qnil;
8856
8992
 
8857
- if ((argc < 4) || (argc > 4)) {
8858
- rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
8993
+ if ((argc < 5) || (argc > 5)) {
8994
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc); SWIG_fail;
8859
8995
  }
8860
8996
  res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
8861
8997
  if (!SWIG_IsOK(res1)) {
@@ -8884,7 +9020,12 @@ _wrap_memcached_mget_by_key(int argc, VALUE *argv, VALUE self) {
8884
9020
  arg4[i] = StringValuePtr(RARRAY_PTR(argv[3])[i]);
8885
9021
  }
8886
9022
  }
8887
- result = (memcached_return)memcached_mget_by_key(arg1,(char const *)arg2,arg3,(char const **)arg4,arg5,arg6);
9023
+ ecode7 = SWIG_AsVal_unsigned_SS_int(argv[4], &val7);
9024
+ if (!SWIG_IsOK(ecode7)) {
9025
+ SWIG_exception_fail(SWIG_ArgError(ecode7), Ruby_Format_TypeError( "", "uint32_t","memcached_mget_by_key", 7, argv[4] ));
9026
+ }
9027
+ arg7 = (uint32_t)(val7);
9028
+ result = (memcached_return)memcached_mget_by_key(arg1,(char const *)arg2,arg3,(char const **)arg4,arg5,arg6,arg7);
8888
9029
  vresult = SWIG_From_int((int)(result));
8889
9030
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
8890
9031
  return vresult;
@@ -12366,6 +12507,64 @@ fail:
12366
12507
  }
12367
12508
 
12368
12509
 
12510
+ SWIGINTERN VALUE
12511
+ _wrap_memcached_get_len_rvalue(int argc, VALUE *argv, VALUE self) {
12512
+ memcached_st *arg1 = (memcached_st *) 0 ;
12513
+ char *arg2 = (char *) 0 ;
12514
+ size_t arg3 ;
12515
+ uint32_t arg4 ;
12516
+ uint32_t *arg5 = (uint32_t *) 0 ;
12517
+ memcached_return *arg6 = (memcached_return *) 0 ;
12518
+ void *argp1 = 0 ;
12519
+ int res1 = 0 ;
12520
+ unsigned int val4 ;
12521
+ int ecode4 = 0 ;
12522
+ uint32_t temp5 ;
12523
+ int res5 = SWIG_TMPOBJ ;
12524
+ memcached_return temp6 ;
12525
+ int res6 = SWIG_TMPOBJ ;
12526
+ VALUE result;
12527
+ VALUE vresult = Qnil;
12528
+
12529
+ arg5 = &temp5;
12530
+ arg6 = &temp6;
12531
+ if ((argc < 3) || (argc > 3)) {
12532
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
12533
+ }
12534
+ res1 = SWIG_ConvertPtr(argv[0], &argp1,SWIGTYPE_p_memcached_st, 0 | 0 );
12535
+ if (!SWIG_IsOK(res1)) {
12536
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "memcached_st *","memcached_get_len_rvalue", 1, argv[0] ));
12537
+ }
12538
+ arg1 = (memcached_st *)(argp1);
12539
+ {
12540
+ arg2 = StringValuePtr(argv[1]);
12541
+ arg3 = (size_t) RSTRING_LEN(argv[1]);
12542
+ }
12543
+ ecode4 = SWIG_AsVal_unsigned_SS_int(argv[2], &val4);
12544
+ if (!SWIG_IsOK(ecode4)) {
12545
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "uint32_t","memcached_get_len_rvalue", 4, argv[2] ));
12546
+ }
12547
+ arg4 = (uint32_t)(val4);
12548
+ result = (VALUE)memcached_get_len_rvalue(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
12549
+ vresult = result;
12550
+ if (SWIG_IsTmpObj(res5)) {
12551
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_int((*arg5)));
12552
+ } else {
12553
+ int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
12554
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_uint32_t, new_flags));
12555
+ }
12556
+ if (SWIG_IsTmpObj(res6)) {
12557
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_From_unsigned_SS_short((*arg6)));
12558
+ } else {
12559
+ int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
12560
+ vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_memcached_return, new_flags));
12561
+ }
12562
+ return vresult;
12563
+ fail:
12564
+ return Qnil;
12565
+ }
12566
+
12567
+
12369
12568
  SWIGINTERN VALUE
12370
12569
  _wrap_memcached_get_from_last_rvalue(int argc, VALUE *argv, VALUE self) {
12371
12570
  memcached_st *arg1 = (memcached_st *) 0 ;
@@ -13359,8 +13558,12 @@ SWIGEXPORT void Init_rlibmemcached(void) {
13359
13558
  rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_TCP", SWIG_From_int((int)(MEMCACHED_CONNECTION_TCP)));
13360
13559
  rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_UDP", SWIG_From_int((int)(MEMCACHED_CONNECTION_UDP)));
13361
13560
  rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_UNIX_SOCKET", SWIG_From_int((int)(MEMCACHED_CONNECTION_UNIX_SOCKET)));
13561
+ rb_define_const(mRlibmemcached, "GET_LEN_ARG_UNSPECIFIED", SWIG_From_unsigned_SS_int((unsigned int)(-1U)));
13562
+ rb_define_const(mRlibmemcached, "GET_LEN_BUFSZ", SWIG_From_int((int)(32)));
13362
13563
  rb_define_module_function(mRlibmemcached, "memcached_get", _wrap_memcached_get, -1);
13564
+ rb_define_module_function(mRlibmemcached, "memcached_get_len", _wrap_memcached_get_len, -1);
13363
13565
  rb_define_module_function(mRlibmemcached, "memcached_mget", _wrap_memcached_mget, -1);
13566
+ rb_define_module_function(mRlibmemcached, "memcached_mget_len", _wrap_memcached_mget_len, -1);
13364
13567
  rb_define_module_function(mRlibmemcached, "memcached_get_by_key", _wrap_memcached_get_by_key, -1);
13365
13568
  rb_define_module_function(mRlibmemcached, "memcached_mget_by_key", _wrap_memcached_mget_by_key, -1);
13366
13569
  rb_define_module_function(mRlibmemcached, "memcached_fetch", _wrap_memcached_fetch, -1);
@@ -13484,6 +13687,7 @@ SWIGEXPORT void Init_rlibmemcached(void) {
13484
13687
  rb_define_module_function(mRlibmemcached, "memcached_get_sasl_callbacks", _wrap_memcached_get_sasl_callbacks, -1);
13485
13688
  rb_define_module_function(mRlibmemcached, "memcached_sasl_authenticate_connection", _wrap_memcached_sasl_authenticate_connection, -1);
13486
13689
  rb_define_module_function(mRlibmemcached, "memcached_get_rvalue", _wrap_memcached_get_rvalue, -1);
13690
+ rb_define_module_function(mRlibmemcached, "memcached_get_len_rvalue", _wrap_memcached_get_len_rvalue, -1);
13487
13691
  rb_define_module_function(mRlibmemcached, "memcached_get_from_last_rvalue", _wrap_memcached_get_from_last_rvalue, -1);
13488
13692
  rb_define_module_function(mRlibmemcached, "memcached_fetch_rvalue", _wrap_memcached_fetch_rvalue, -1);
13489
13693
  rb_define_module_function(mRlibmemcached, "memcached_stat_get_rvalue", _wrap_memcached_stat_get_rvalue, -1);
@@ -30,3 +30,4 @@ require 'memcached/behaviors'
30
30
  require 'memcached/auth'
31
31
  require 'memcached/memcached'
32
32
  require 'memcached/rails'
33
+ require 'memcached/experimental_memcached'
@@ -0,0 +1,31 @@
1
+ module ExperimentalMemcached
2
+ def get_len(user_spec_len, keys)
3
+ if keys.is_a? ::Array
4
+ # Multi get
5
+ ret = ::Memcached::Lib.memcached_mget_len(@struct, keys, user_spec_len);
6
+ check_return_code(ret, keys)
7
+
8
+ hash = {}
9
+ keys.each do
10
+ value, key, flags, ret = ::Memcached::Lib.memcached_fetch_rvalue(@struct)
11
+ break if ret == ::Memcached::Lib::MEMCACHED_END
12
+ if ret != ::Memcached::Lib::MEMCACHED_NOTFOUND
13
+ check_return_code(ret, key)
14
+ # Assign the value
15
+ hash[key] = value
16
+ end
17
+ end
18
+ hash
19
+ else
20
+ # Single get_len
21
+ value, flags, ret = ::Memcached::Lib.memcached_get_len_rvalue(@struct, keys, user_spec_len)
22
+ check_return_code(ret, keys)
23
+ value
24
+ end
25
+ rescue => e
26
+ tries ||= 0
27
+ raise unless tries < options[:exception_retry_limit] && should_retry(e)
28
+ tries += 1
29
+ retry
30
+ end
31
+ end
@@ -33,6 +33,7 @@ class Memcached
33
33
  :use_udp => false,
34
34
  :binary_protocol => false,
35
35
  :credentials => nil,
36
+ :experimental_features => false,
36
37
  :exception_retry_limit => 5,
37
38
  :exceptions_to_retry => [
38
39
  Memcached::ServerIsMarkedDead,
@@ -118,6 +119,10 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
118
119
  options[:credentials] = [ENV["MEMCACHE_USERNAME"], ENV["MEMCACHE_PASSWORD"]]
119
120
  end
120
121
 
122
+ if options[:experimental_features]
123
+ instance_eval { send(:extend, ::ExperimentalMemcached) }
124
+ end
125
+
121
126
  options[:binary_protocol] = true if options[:credentials] != nil
122
127
 
123
128
  # Force :buffer_requests to use :no_block
@@ -521,7 +526,7 @@ Please note that when <tt>:no_block => true</tt>, update methods do not raise on
521
526
  tries ||= 0
522
527
  raise unless tries < options[:exception_retry_limit] && should_retry(e)
523
528
  tries += 1
524
- retry
529
+ retry
525
530
  end
526
531
 
527
532
  # Gets a key's value from the previous server. Only useful with random distribution.