Changeset 5038
- Timestamp:
- 01/20/08 14:23:51 (5 years ago)
- Location:
- lang/perl/Cache-Memcached-LibMemcached/trunk
- Files:
-
- 4 modified
-
LibMemcached.xs (modified) (2 diffs)
-
lib/Cache/Memcached/LibMemcached.pm (modified) (2 diffs)
-
perl-libmemcached.c (modified) (10 diffs)
-
perl-libmemcached.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Cache-Memcached-LibMemcached/trunk/LibMemcached.xs
r4735 r5038 15 15 16 16 SV * 17 Cache_LibMemcached__XS_new(pkg, have_zlib, compress_enabled, compress_threshold, compress_savings )17 Cache_LibMemcached__XS_new(pkg, have_zlib, compress_enabled, compress_threshold, compress_savings, compress_method, uncompress_method, serialize_method, deserialize_method) 18 18 char *pkg; 19 19 bool have_zlib; … … 21 21 size_t compress_threshold; 22 22 float compress_savings; 23 CODE: 24 RETVAL = Cache_LibMemcached_create(pkg, have_zlib, compress_enabled, compress_threshold, compress_savings); 23 SV *compress_method; 24 SV *uncompress_method; 25 SV *serialize_method; 26 SV *deserialize_method; 27 CODE: 28 RETVAL = Cache_LibMemcached_create(pkg, have_zlib, compress_enabled, compress_threshold, compress_savings, compress_method, uncompress_method, serialize_method, deserialize_method); 25 29 OUTPUT: 26 30 RETVAL -
lang/perl/Cache-Memcached-LibMemcached/trunk/lib/Cache/Memcached/LibMemcached.pm
r5025 r5038 8 8 use warnings; 9 9 use Carp 'croak'; 10 use Storable ;10 use Storable (); 11 11 use constant HAVE_ZLIB => eval "use Compress::Zlib (); 1;"; 12 12 use constant COMPRESS_SAVINGS => 0.20; … … 38 38 $args->{compress_threshold} || 0, 39 39 COMPRESS_SAVINGS, 40 \&Compress::Zlib::memGzip,41 \&Compress::Zlib::memGunzip,40 HAVE_ZLIB ? \&Compress::Zlib::memGzip : undef, 41 HAVE_ZLIB ? \&Compress::Zlib::memGunzip : undef, 42 42 \&Storable::nfreeze, 43 43 \&Storable::thaw, -
lang/perl/Cache-Memcached-LibMemcached/trunk/perl-libmemcached.c
r4986 r5038 8 8 #define __PERL_LIBMEMCACHED_C__ 9 9 #include "perl-libmemcached.h" 10 11 #define ASSERT_CALLBACK(x) \ 12 if (! SvOK(x) || ! SvROK(x) || SvTYPE(SvRV(x) ) != SVt_PVCV) { \ 13 croak("provided argument is not a coderef!"); \ 14 } 10 15 11 16 #define CONSTSUBi(name, x) \ … … 112 117 PUTBACK; 113 118 114 if (call_ pv("Compress::Zlib::memGunzip", G_SCALAR) <= 0) {115 croak(" Compress::Zlib::memGunzipdid not return a proper value");119 if (call_sv(MEMCACHED_UNCOMPRESS_METHOD(cache), G_SCALAR) <= 0) { 120 croak("uncompress_method did not return a proper value"); 116 121 } 117 122 SPAGAIN; … … 142 147 PUTBACK; 143 148 144 if (call_ pv("Storable::thaw", G_SCALAR) <= 0) {145 croak(" Storable::thawdid not return a proper value");149 if (call_sv(MEMCACHED_DESERIALIZE_METHOD(cache), G_SCALAR) <= 0) { 150 croak("deserialize_method did not return a proper value"); 146 151 } 147 152 SPAGAIN; … … 173 178 PUTBACK; 174 179 175 if (call_ pv("Storable::freeze", G_SCALAR) <= 0) {176 croak(" Storable::freezedid not return a proper value");180 if (call_sv(MEMCACHED_SERIALIZE_METHOD(cache), G_SCALAR) <= 0) { 181 croak("serialize_method did not return a proper value"); 177 182 } 178 183 SPAGAIN; … … 217 222 PUTBACK; 218 223 219 if (call_ pv("Compress::Zlib::memGzip", G_SCALAR) <= 0) {220 croak(" Compress::Zlib::memGzipdid not return a proper value");224 if (call_sv(MEMCACHED_COMPRESS_METHOD(cache), G_SCALAR) <= 0) { 225 croak("compress_method did not return a proper value"); 221 226 } 222 227 SPAGAIN; … … 311 316 312 317 SV * 313 Cache_LibMemcached_create(pkg, have_zlib, compress_enabled, compress_threshold, compress_savings )318 Cache_LibMemcached_create(pkg, have_zlib, compress_enabled, compress_threshold, compress_savings, compress_method, uncompress_method, serialize_method, deserialize_method) 314 319 char *pkg; 315 320 bool have_zlib; … … 317 322 size_t compress_threshold; 318 323 float compress_savings; 324 SV *compress_method; 325 SV *uncompress_method; 326 SV *serialize_method; 327 SV *deserialize_method; 319 328 { 320 329 SV *sv; … … 329 338 MEMCACHED_COMPRESS_THRESHOLD(xs) = compress_threshold; 330 339 MEMCACHED_COMPRESS_SAVINGS(xs) = compress_savings; 340 MEMCACHED_COMPRESS_METHOD(xs) = compress_method; 341 MEMCACHED_UNCOMPRESS_METHOD(xs) = uncompress_method; 342 MEMCACHED_SERIALIZE_METHOD(xs) = serialize_method; 343 MEMCACHED_DESERIALIZE_METHOD(xs) = deserialize_method; 344 345 SvREFCNT_inc(compress_method); 346 SvREFCNT_inc(uncompress_method); 347 SvREFCNT_inc(serialize_method); 348 SvREFCNT_inc(deserialize_method); 349 ASSERT_CALLBACK( MEMCACHED_SERIALIZE_METHOD(xs) ); 331 350 332 351 XS_STRUCT2OBJ(sv, "Cache::Memcached::LibMemcached", xs); … … 341 360 memcached_quit(MEMCACHED_CACHE(cache)); 342 361 memcached_free(MEMCACHED_CACHE(cache)); 362 SvREFCNT_dec(MEMCACHED_COMPRESS_METHOD(cache)); 363 SvREFCNT_dec(MEMCACHED_UNCOMPRESS_METHOD(cache)); 364 SvREFCNT_dec(MEMCACHED_DESERIALIZE_METHOD(cache)); 365 SvREFCNT_dec(MEMCACHED_SERIALIZE_METHOD(cache)); 343 366 } 344 367 … … 419 442 420 443 hv = newHV(); 421 while (1) { 444 for(i = 0; i < keys_len; i++) { 445 /* while (1) {*/ 422 446 char *value; 423 447 char key[MEMCACHED_MAX_KEY]; -
lang/perl/Cache-Memcached-LibMemcached/trunk/perl-libmemcached.h
r4736 r5038 35 35 size_t compress_threshold; 36 36 NV compress_savings; 37 SV *compress_method; 38 SV *uncompress_method; 39 SV *serialize_method; 40 SV *deserialize_method; 37 41 } Cache_LibMemcached; 38 42 … … 42 46 #define MEMCACHED_COMPRESS_THRESHOLD(x) x->compress_threshold 43 47 #define MEMCACHED_COMPRESS_SAVINGS(x) x->compress_savings 48 #define MEMCACHED_COMPRESS_METHOD(x) x->compress_method 49 #define MEMCACHED_UNCOMPRESS_METHOD(x) x->uncompress_method 50 #define MEMCACHED_SERIALIZE_METHOD(x) x->serialize_method 51 #define MEMCACHED_DESERIALIZE_METHOD(x) x->deserialize_method 44 52 45 53 typedef memcached_return Cache_LibMemcached_rc; 46 54 typedef memcached_stat_st Cache_LibMemcached_stat; 47 55 48 SV *Cache_LibMemcached_create( 49 char *pkg, 50 bool have_zlib, 51 bool compress_enabled, 52 size_t compress_threshold, 53 float compress_savings 56 SV * 57 Cache_LibMemcached_create( 58 char *pkg, 59 bool have_zlib, 60 bool compress_enabled, 61 size_t compress_threshold, 62 float compress_savings, 63 SV *compress_method, 64 SV *decompress_method, 65 SV *serialize_method, 66 SV *deserialize_method 54 67 ); 55 68
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)