Rename SWIG shared object so as to avoid phase-of-the-moon ld ordering issues on x86_64.

This commit is contained in:
Evan Weaver 2008-02-02 09:14:19 +00:00
Родитель 7671765095
Коммит 5920ef2a67
10 изменённых файлов: 190 добавлений и 190 удалений

Просмотреть файл

@ -1,8 +1,8 @@
CHANGELOG
COMPATIBILITY
ext/extconf.rb
ext/libmemcached.i
ext/libmemcached_wrap.c
ext/rlibmemcached.i
ext/rlibmemcached_wrap.c
lib/memcached/behaviors.rb
lib/memcached/exceptions.rb
lib/memcached/integer.rb

Просмотреть файл

@ -3,7 +3,7 @@ require 'mkmf'
if ENV['SWIG']
puts "running SWIG"
$stdout.write `swig -I/opt/local/include -ruby -autorename libwrap.i`
$stdout.write `swig -I/opt/local/include -ruby -autorename rlibmemcached.i`
end
if ENV['DEBUG']
@ -13,7 +13,7 @@ else
$CFLAGS << " -O2"
end
dir_config 'libwrap'
dir_config 'rlibmemcached'
# XXX There's probably a better way to do this
unless find_library 'memcached', 'memcached_server_add', *ENV['LD_LIBRARY_PATH'].to_s.split(":")
@ -23,4 +23,4 @@ unless find_header 'libmemcached/memcached.h', *ENV['INCLUDE_PATH'].to_s.split("
raise "header file 'libmemcached/memcached.h' not found"
end
create_makefile 'libwrap'
create_makefile 'rlibmemcached'

Просмотреть файл

@ -1,4 +1,4 @@
%module libwrap
%module rlibmemcached
%{
#include <libmemcached/memcached.h>
%}

Просмотреть файл

@ -1748,10 +1748,10 @@ static swig_module_info swig_module = {swig_types, 28, 0, 0, 0, 0};
/* -------- TYPES TABLE (END) -------- */
#define SWIG_init Init_libwrap
#define SWIG_name "Libwrap"
#define SWIG_init Init_rlibmemcached
#define SWIG_name "Rlibmemcached"
static VALUE mLibwrap;
static VALUE mRlibmemcached;
#define SWIG_RUBY_THREAD_BEGIN_BLOCK
#define SWIG_RUBY_THREAD_END_BLOCK
@ -6024,7 +6024,7 @@ fail:
/*
Document-method: Libwrap::MemcachedSt.hash
Document-method: Rlibmemcached::MemcachedSt.hash
call-seq:
hash -> int
@ -6033,7 +6033,7 @@ Hashing function for class.
*/
/*
Document-method: Libwrap::MemcachedSt.hash=
Document-method: Rlibmemcached::MemcachedSt.hash=
call-seq:
hash=(x) -> int
@ -9383,11 +9383,11 @@ SWIG_PropagateClientData(void) {
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void Init_libwrap(void) {
SWIGEXPORT void Init_rlibmemcached(void) {
size_t i;
SWIG_InitRuntime();
mLibwrap = rb_define_module("Libwrap");
mRlibmemcached = rb_define_module("Rlibmemcached");
SWIG_InitializeModule(0);
for (i = 0; i < swig_module.size; i++) {
@ -9395,85 +9395,85 @@ SWIGEXPORT void Init_libwrap(void) {
}
SWIG_RubyInitializeTrackings();
rb_define_const(mLibwrap, "MEMCACHED_VERSION_STRING_LENGTH", SWIG_From_int((int)(12)));
rb_define_const(mLibwrap, "MEMCACHED_DEFAULT_PORT", SWIG_From_int((int)(11211)));
rb_define_const(mLibwrap, "MEMCACHED_MAX_KEY", SWIG_From_int((int)(251)));
rb_define_const(mLibwrap, "MEMCACHED_MAX_BUFFER", SWIG_From_int((int)(8196)));
rb_define_const(mLibwrap, "MEMCACHED_MAX_HOST_LENGTH", SWIG_From_int((int)(64)));
rb_define_const(mLibwrap, "MEMCACHED_WHEEL_SIZE", SWIG_From_int((int)(1024)));
rb_define_const(mLibwrap, "MEMCACHED_STRIDE", SWIG_From_int((int)(4)));
rb_define_const(mLibwrap, "LIBMEMCACHED_VERSION_STRING", SWIG_FromCharPtr("0.14"));
rb_define_const(mLibwrap, "MEMCACHED_SUCCESS", SWIG_From_int((int)(MEMCACHED_SUCCESS)));
rb_define_const(mLibwrap, "MEMCACHED_FAILURE", SWIG_From_int((int)(MEMCACHED_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_HOST_LOOKUP_FAILURE", SWIG_From_int((int)(MEMCACHED_HOST_LOOKUP_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_FAILURE", SWIG_From_int((int)(MEMCACHED_CONNECTION_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_BIND_FAILURE", SWIG_From_int((int)(MEMCACHED_CONNECTION_BIND_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_WRITE_FAILURE", SWIG_From_int((int)(MEMCACHED_WRITE_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_READ_FAILURE", SWIG_From_int((int)(MEMCACHED_READ_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_UNKNOWN_READ_FAILURE", SWIG_From_int((int)(MEMCACHED_UNKNOWN_READ_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_PROTOCOL_ERROR", SWIG_From_int((int)(MEMCACHED_PROTOCOL_ERROR)));
rb_define_const(mLibwrap, "MEMCACHED_CLIENT_ERROR", SWIG_From_int((int)(MEMCACHED_CLIENT_ERROR)));
rb_define_const(mLibwrap, "MEMCACHED_SERVER_ERROR", SWIG_From_int((int)(MEMCACHED_SERVER_ERROR)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE", SWIG_From_int((int)(MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_DATA_EXISTS", SWIG_From_int((int)(MEMCACHED_DATA_EXISTS)));
rb_define_const(mLibwrap, "MEMCACHED_DATA_DOES_NOT_EXIST", SWIG_From_int((int)(MEMCACHED_DATA_DOES_NOT_EXIST)));
rb_define_const(mLibwrap, "MEMCACHED_NOTSTORED", SWIG_From_int((int)(MEMCACHED_NOTSTORED)));
rb_define_const(mLibwrap, "MEMCACHED_STORED", SWIG_From_int((int)(MEMCACHED_STORED)));
rb_define_const(mLibwrap, "MEMCACHED_NOTFOUND", SWIG_From_int((int)(MEMCACHED_NOTFOUND)));
rb_define_const(mLibwrap, "MEMCACHED_MEMORY_ALLOCATION_FAILURE", SWIG_From_int((int)(MEMCACHED_MEMORY_ALLOCATION_FAILURE)));
rb_define_const(mLibwrap, "MEMCACHED_PARTIAL_READ", SWIG_From_int((int)(MEMCACHED_PARTIAL_READ)));
rb_define_const(mLibwrap, "MEMCACHED_SOME_ERRORS", SWIG_From_int((int)(MEMCACHED_SOME_ERRORS)));
rb_define_const(mLibwrap, "MEMCACHED_NO_SERVERS", SWIG_From_int((int)(MEMCACHED_NO_SERVERS)));
rb_define_const(mLibwrap, "MEMCACHED_END", SWIG_From_int((int)(MEMCACHED_END)));
rb_define_const(mLibwrap, "MEMCACHED_DELETED", SWIG_From_int((int)(MEMCACHED_DELETED)));
rb_define_const(mLibwrap, "MEMCACHED_VALUE", SWIG_From_int((int)(MEMCACHED_VALUE)));
rb_define_const(mLibwrap, "MEMCACHED_STAT", SWIG_From_int((int)(MEMCACHED_STAT)));
rb_define_const(mLibwrap, "MEMCACHED_ERRNO", SWIG_From_int((int)(MEMCACHED_ERRNO)));
rb_define_const(mLibwrap, "MEMCACHED_FAIL_UNIX_SOCKET", SWIG_From_int((int)(MEMCACHED_FAIL_UNIX_SOCKET)));
rb_define_const(mLibwrap, "MEMCACHED_NOT_SUPPORTED", SWIG_From_int((int)(MEMCACHED_NOT_SUPPORTED)));
rb_define_const(mLibwrap, "MEMCACHED_NO_KEY_PROVIDED", SWIG_From_int((int)(MEMCACHED_NO_KEY_PROVIDED)));
rb_define_const(mLibwrap, "MEMCACHED_FETCH_NOTFINISHED", SWIG_From_int((int)(MEMCACHED_FETCH_NOTFINISHED)));
rb_define_const(mLibwrap, "MEMCACHED_TIMEOUT", SWIG_From_int((int)(MEMCACHED_TIMEOUT)));
rb_define_const(mLibwrap, "MEMCACHED_BUFFERED", SWIG_From_int((int)(MEMCACHED_BUFFERED)));
rb_define_const(mLibwrap, "MEMCACHED_MAXIMUM_RETURN", SWIG_From_int((int)(MEMCACHED_MAXIMUM_RETURN)));
rb_define_const(mLibwrap, "MEMCACHED_DISTRIBUTION_MODULA", SWIG_From_int((int)(MEMCACHED_DISTRIBUTION_MODULA)));
rb_define_const(mLibwrap, "MEMCACHED_DISTRIBUTION_CONSISTENT", SWIG_From_int((int)(MEMCACHED_DISTRIBUTION_CONSISTENT)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_NO_BLOCK", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_NO_BLOCK)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_TCP_NODELAY", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_TCP_NODELAY)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_HASH", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_HASH)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_KETAMA", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_KETAMA)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_CACHE_LOOKUPS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_CACHE_LOOKUPS)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_SUPPORT_CAS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_SUPPORT_CAS)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_POLL_TIMEOUT", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_POLL_TIMEOUT)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_DISTRIBUTION", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_DISTRIBUTION)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_BUFFER_REQUESTS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_BUFFER_REQUESTS)));
rb_define_const(mLibwrap, "MEMCACHED_BEHAVIOR_USER_DATA", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_USER_DATA)));
rb_define_const(mLibwrap, "MEMCACHED_CALLBACK_USER_DATA", SWIG_From_int((int)(MEMCACHED_CALLBACK_USER_DATA)));
rb_define_const(mLibwrap, "MEMCACHED_CALLBACK_CLEANUP_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_CLEANUP_FUNCTION)));
rb_define_const(mLibwrap, "MEMCACHED_CALLBACK_CLONE_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_CLONE_FUNCTION)));
rb_define_const(mLibwrap, "MEMCACHED_CALLBACK_MALLOC_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_MALLOC_FUNCTION)));
rb_define_const(mLibwrap, "MEMCACHED_CALLBACK_REALLOC_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_REALLOC_FUNCTION)));
rb_define_const(mLibwrap, "MEMCACHED_CALLBACK_FREE_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_FREE_FUNCTION)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_DEFAULT", SWIG_From_int((int)(MEMCACHED_HASH_DEFAULT)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_MD5", SWIG_From_int((int)(MEMCACHED_HASH_MD5)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_CRC", SWIG_From_int((int)(MEMCACHED_HASH_CRC)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_FNV1_64", SWIG_From_int((int)(MEMCACHED_HASH_FNV1_64)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_FNV1A_64", SWIG_From_int((int)(MEMCACHED_HASH_FNV1A_64)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_FNV1_32", SWIG_From_int((int)(MEMCACHED_HASH_FNV1_32)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_FNV1A_32", SWIG_From_int((int)(MEMCACHED_HASH_FNV1A_32)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_KETAMA", SWIG_From_int((int)(MEMCACHED_HASH_KETAMA)));
rb_define_const(mLibwrap, "MEMCACHED_HASH_HSIEH", SWIG_From_int((int)(MEMCACHED_HASH_HSIEH)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_UNKNOWN", SWIG_From_int((int)(MEMCACHED_CONNECTION_UNKNOWN)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_TCP", SWIG_From_int((int)(MEMCACHED_CONNECTION_TCP)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_UDP", SWIG_From_int((int)(MEMCACHED_CONNECTION_UDP)));
rb_define_const(mLibwrap, "MEMCACHED_CONNECTION_UNIX_SOCKET", SWIG_From_int((int)(MEMCACHED_CONNECTION_UNIX_SOCKET)));
rb_define_const(mLibwrap, "MEMCACHED_NOT_ALLOCATED", SWIG_From_int((int)(MEMCACHED_NOT_ALLOCATED)));
rb_define_const(mLibwrap, "MEMCACHED_ALLOCATED", SWIG_From_int((int)(MEMCACHED_ALLOCATED)));
rb_define_const(mLibwrap, "MEMCACHED_USED", SWIG_From_int((int)(MEMCACHED_USED)));
rb_define_const(mRlibmemcached, "MEMCACHED_VERSION_STRING_LENGTH", SWIG_From_int((int)(12)));
rb_define_const(mRlibmemcached, "MEMCACHED_DEFAULT_PORT", SWIG_From_int((int)(11211)));
rb_define_const(mRlibmemcached, "MEMCACHED_MAX_KEY", SWIG_From_int((int)(251)));
rb_define_const(mRlibmemcached, "MEMCACHED_MAX_BUFFER", SWIG_From_int((int)(8196)));
rb_define_const(mRlibmemcached, "MEMCACHED_MAX_HOST_LENGTH", SWIG_From_int((int)(64)));
rb_define_const(mRlibmemcached, "MEMCACHED_WHEEL_SIZE", SWIG_From_int((int)(1024)));
rb_define_const(mRlibmemcached, "MEMCACHED_STRIDE", SWIG_From_int((int)(4)));
rb_define_const(mRlibmemcached, "LIBMEMCACHED_VERSION_STRING", SWIG_FromCharPtr("0.14"));
rb_define_const(mRlibmemcached, "MEMCACHED_SUCCESS", SWIG_From_int((int)(MEMCACHED_SUCCESS)));
rb_define_const(mRlibmemcached, "MEMCACHED_FAILURE", SWIG_From_int((int)(MEMCACHED_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_HOST_LOOKUP_FAILURE", SWIG_From_int((int)(MEMCACHED_HOST_LOOKUP_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_FAILURE", SWIG_From_int((int)(MEMCACHED_CONNECTION_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_BIND_FAILURE", SWIG_From_int((int)(MEMCACHED_CONNECTION_BIND_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_WRITE_FAILURE", SWIG_From_int((int)(MEMCACHED_WRITE_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_READ_FAILURE", SWIG_From_int((int)(MEMCACHED_READ_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_UNKNOWN_READ_FAILURE", SWIG_From_int((int)(MEMCACHED_UNKNOWN_READ_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_PROTOCOL_ERROR", SWIG_From_int((int)(MEMCACHED_PROTOCOL_ERROR)));
rb_define_const(mRlibmemcached, "MEMCACHED_CLIENT_ERROR", SWIG_From_int((int)(MEMCACHED_CLIENT_ERROR)));
rb_define_const(mRlibmemcached, "MEMCACHED_SERVER_ERROR", SWIG_From_int((int)(MEMCACHED_SERVER_ERROR)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE", SWIG_From_int((int)(MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_DATA_EXISTS", SWIG_From_int((int)(MEMCACHED_DATA_EXISTS)));
rb_define_const(mRlibmemcached, "MEMCACHED_DATA_DOES_NOT_EXIST", SWIG_From_int((int)(MEMCACHED_DATA_DOES_NOT_EXIST)));
rb_define_const(mRlibmemcached, "MEMCACHED_NOTSTORED", SWIG_From_int((int)(MEMCACHED_NOTSTORED)));
rb_define_const(mRlibmemcached, "MEMCACHED_STORED", SWIG_From_int((int)(MEMCACHED_STORED)));
rb_define_const(mRlibmemcached, "MEMCACHED_NOTFOUND", SWIG_From_int((int)(MEMCACHED_NOTFOUND)));
rb_define_const(mRlibmemcached, "MEMCACHED_MEMORY_ALLOCATION_FAILURE", SWIG_From_int((int)(MEMCACHED_MEMORY_ALLOCATION_FAILURE)));
rb_define_const(mRlibmemcached, "MEMCACHED_PARTIAL_READ", SWIG_From_int((int)(MEMCACHED_PARTIAL_READ)));
rb_define_const(mRlibmemcached, "MEMCACHED_SOME_ERRORS", SWIG_From_int((int)(MEMCACHED_SOME_ERRORS)));
rb_define_const(mRlibmemcached, "MEMCACHED_NO_SERVERS", SWIG_From_int((int)(MEMCACHED_NO_SERVERS)));
rb_define_const(mRlibmemcached, "MEMCACHED_END", SWIG_From_int((int)(MEMCACHED_END)));
rb_define_const(mRlibmemcached, "MEMCACHED_DELETED", SWIG_From_int((int)(MEMCACHED_DELETED)));
rb_define_const(mRlibmemcached, "MEMCACHED_VALUE", SWIG_From_int((int)(MEMCACHED_VALUE)));
rb_define_const(mRlibmemcached, "MEMCACHED_STAT", SWIG_From_int((int)(MEMCACHED_STAT)));
rb_define_const(mRlibmemcached, "MEMCACHED_ERRNO", SWIG_From_int((int)(MEMCACHED_ERRNO)));
rb_define_const(mRlibmemcached, "MEMCACHED_FAIL_UNIX_SOCKET", SWIG_From_int((int)(MEMCACHED_FAIL_UNIX_SOCKET)));
rb_define_const(mRlibmemcached, "MEMCACHED_NOT_SUPPORTED", SWIG_From_int((int)(MEMCACHED_NOT_SUPPORTED)));
rb_define_const(mRlibmemcached, "MEMCACHED_NO_KEY_PROVIDED", SWIG_From_int((int)(MEMCACHED_NO_KEY_PROVIDED)));
rb_define_const(mRlibmemcached, "MEMCACHED_FETCH_NOTFINISHED", SWIG_From_int((int)(MEMCACHED_FETCH_NOTFINISHED)));
rb_define_const(mRlibmemcached, "MEMCACHED_TIMEOUT", SWIG_From_int((int)(MEMCACHED_TIMEOUT)));
rb_define_const(mRlibmemcached, "MEMCACHED_BUFFERED", SWIG_From_int((int)(MEMCACHED_BUFFERED)));
rb_define_const(mRlibmemcached, "MEMCACHED_MAXIMUM_RETURN", SWIG_From_int((int)(MEMCACHED_MAXIMUM_RETURN)));
rb_define_const(mRlibmemcached, "MEMCACHED_DISTRIBUTION_MODULA", SWIG_From_int((int)(MEMCACHED_DISTRIBUTION_MODULA)));
rb_define_const(mRlibmemcached, "MEMCACHED_DISTRIBUTION_CONSISTENT", SWIG_From_int((int)(MEMCACHED_DISTRIBUTION_CONSISTENT)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_NO_BLOCK", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_NO_BLOCK)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_TCP_NODELAY", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_TCP_NODELAY)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_HASH", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_HASH)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_KETAMA", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_KETAMA)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_CACHE_LOOKUPS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_CACHE_LOOKUPS)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_SUPPORT_CAS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_SUPPORT_CAS)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_POLL_TIMEOUT", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_POLL_TIMEOUT)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_DISTRIBUTION", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_DISTRIBUTION)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_BUFFER_REQUESTS", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_BUFFER_REQUESTS)));
rb_define_const(mRlibmemcached, "MEMCACHED_BEHAVIOR_USER_DATA", SWIG_From_int((int)(MEMCACHED_BEHAVIOR_USER_DATA)));
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_USER_DATA", SWIG_From_int((int)(MEMCACHED_CALLBACK_USER_DATA)));
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_CLEANUP_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_CLEANUP_FUNCTION)));
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_CLONE_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_CLONE_FUNCTION)));
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_MALLOC_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_MALLOC_FUNCTION)));
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_REALLOC_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_REALLOC_FUNCTION)));
rb_define_const(mRlibmemcached, "MEMCACHED_CALLBACK_FREE_FUNCTION", SWIG_From_int((int)(MEMCACHED_CALLBACK_FREE_FUNCTION)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_DEFAULT", SWIG_From_int((int)(MEMCACHED_HASH_DEFAULT)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_MD5", SWIG_From_int((int)(MEMCACHED_HASH_MD5)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_CRC", SWIG_From_int((int)(MEMCACHED_HASH_CRC)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_FNV1_64", SWIG_From_int((int)(MEMCACHED_HASH_FNV1_64)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_FNV1A_64", SWIG_From_int((int)(MEMCACHED_HASH_FNV1A_64)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_FNV1_32", SWIG_From_int((int)(MEMCACHED_HASH_FNV1_32)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_FNV1A_32", SWIG_From_int((int)(MEMCACHED_HASH_FNV1A_32)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_KETAMA", SWIG_From_int((int)(MEMCACHED_HASH_KETAMA)));
rb_define_const(mRlibmemcached, "MEMCACHED_HASH_HSIEH", SWIG_From_int((int)(MEMCACHED_HASH_HSIEH)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_UNKNOWN", SWIG_From_int((int)(MEMCACHED_CONNECTION_UNKNOWN)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_TCP", SWIG_From_int((int)(MEMCACHED_CONNECTION_TCP)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_UDP", SWIG_From_int((int)(MEMCACHED_CONNECTION_UDP)));
rb_define_const(mRlibmemcached, "MEMCACHED_CONNECTION_UNIX_SOCKET", SWIG_From_int((int)(MEMCACHED_CONNECTION_UNIX_SOCKET)));
rb_define_const(mRlibmemcached, "MEMCACHED_NOT_ALLOCATED", SWIG_From_int((int)(MEMCACHED_NOT_ALLOCATED)));
rb_define_const(mRlibmemcached, "MEMCACHED_ALLOCATED", SWIG_From_int((int)(MEMCACHED_ALLOCATED)));
rb_define_const(mRlibmemcached, "MEMCACHED_USED", SWIG_From_int((int)(MEMCACHED_USED)));
cMemcachedServerSt.klass = rb_define_class_under(mLibwrap, "MemcachedServerSt", rb_cObject);
cMemcachedServerSt.klass = rb_define_class_under(mRlibmemcached, "MemcachedServerSt", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_memcached_server_st, (void *) &cMemcachedServerSt);
rb_define_alloc_func(cMemcachedServerSt.klass, _wrap_MemcachedServerSt_allocate);
rb_define_method(cMemcachedServerSt.klass, "initialize", _wrap_new_MemcachedServerSt, -1);
@ -9519,7 +9519,7 @@ SWIGEXPORT void Init_libwrap(void) {
cMemcachedServerSt.destroy = (void (*)(void *)) free_memcached_server_st;
cMemcachedServerSt.trackObjects = 0;
cMemcachedStatSt.klass = rb_define_class_under(mLibwrap, "MemcachedStatSt", rb_cObject);
cMemcachedStatSt.klass = rb_define_class_under(mRlibmemcached, "MemcachedStatSt", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_memcached_stat_st, (void *) &cMemcachedStatSt);
rb_define_alloc_func(cMemcachedStatSt.klass, _wrap_MemcachedStatSt_allocate);
rb_define_method(cMemcachedStatSt.klass, "initialize", _wrap_new_MemcachedStatSt, -1);
@ -9575,7 +9575,7 @@ SWIGEXPORT void Init_libwrap(void) {
cMemcachedStatSt.destroy = (void (*)(void *)) free_memcached_stat_st;
cMemcachedStatSt.trackObjects = 0;
cMemcachedStringSt.klass = rb_define_class_under(mLibwrap, "MemcachedStringSt", rb_cObject);
cMemcachedStringSt.klass = rb_define_class_under(mRlibmemcached, "MemcachedStringSt", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_memcached_string_st, (void *) &cMemcachedStringSt);
rb_define_alloc_func(cMemcachedStringSt.klass, _wrap_MemcachedStringSt_allocate);
rb_define_method(cMemcachedStringSt.klass, "initialize", _wrap_new_MemcachedStringSt, -1);
@ -9595,7 +9595,7 @@ SWIGEXPORT void Init_libwrap(void) {
cMemcachedStringSt.destroy = (void (*)(void *)) free_memcached_string_st;
cMemcachedStringSt.trackObjects = 0;
cMemcachedResultSt.klass = rb_define_class_under(mLibwrap, "MemcachedResultSt", rb_cObject);
cMemcachedResultSt.klass = rb_define_class_under(mRlibmemcached, "MemcachedResultSt", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_memcached_result_st, (void *) &cMemcachedResultSt);
rb_define_alloc_func(cMemcachedResultSt.klass, _wrap_MemcachedResultSt_allocate);
rb_define_method(cMemcachedResultSt.klass, "initialize", _wrap_new_MemcachedResultSt, -1);
@ -9617,7 +9617,7 @@ SWIGEXPORT void Init_libwrap(void) {
cMemcachedResultSt.destroy = (void (*)(void *)) free_memcached_result_st;
cMemcachedResultSt.trackObjects = 0;
cMemcachedSt.klass = rb_define_class_under(mLibwrap, "MemcachedSt", rb_cObject);
cMemcachedSt.klass = rb_define_class_under(mRlibmemcached, "MemcachedSt", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_memcached_st, (void *) &cMemcachedSt);
rb_define_alloc_func(cMemcachedSt.klass, _wrap_MemcachedSt_allocate);
rb_define_method(cMemcachedSt.klass, "initialize", _wrap_new_MemcachedSt, -1);
@ -9662,60 +9662,60 @@ SWIGEXPORT void Init_libwrap(void) {
cMemcachedSt.mark = 0;
cMemcachedSt.destroy = (void (*)(void *)) free_memcached_st;
cMemcachedSt.trackObjects = 0;
rb_define_module_function(mLibwrap, "memcached_lib_version", _wrap_memcached_lib_version, -1);
rb_define_module_function(mLibwrap, "memcached_create", _wrap_memcached_create, -1);
rb_define_module_function(mLibwrap, "memcached_free", _wrap_memcached_free, -1);
rb_define_module_function(mLibwrap, "memcached_clone", _wrap_memcached_clone, -1);
rb_define_module_function(mLibwrap, "memcached_delete", _wrap_memcached_delete, -1);
rb_define_module_function(mLibwrap, "memcached_increment", _wrap_memcached_increment, -1);
rb_define_module_function(mLibwrap, "memcached_decrement", _wrap_memcached_decrement, -1);
rb_define_module_function(mLibwrap, "memcached_stat_free", _wrap_memcached_stat_free, -1);
rb_define_module_function(mLibwrap, "memcached_stat", _wrap_memcached_stat, -1);
rb_define_module_function(mLibwrap, "memcached_stat_servername", _wrap_memcached_stat_servername, -1);
rb_define_module_function(mLibwrap, "memcached_flush", _wrap_memcached_flush, -1);
rb_define_module_function(mLibwrap, "memcached_verbosity", _wrap_memcached_verbosity, -1);
rb_define_module_function(mLibwrap, "memcached_quit", _wrap_memcached_quit, -1);
rb_define_module_function(mLibwrap, "memcached_strerror", _wrap_memcached_strerror, -1);
rb_define_module_function(mLibwrap, "memcached_behavior_set", _wrap_memcached_behavior_set, -1);
rb_define_module_function(mLibwrap, "memcached_behavior_get", _wrap_memcached_behavior_get, -1);
rb_define_module_function(mLibwrap, "memcached_set", _wrap_memcached_set, -1);
rb_define_module_function(mLibwrap, "memcached_add", _wrap_memcached_add, -1);
rb_define_module_function(mLibwrap, "memcached_replace", _wrap_memcached_replace, -1);
rb_define_module_function(mLibwrap, "memcached_append", _wrap_memcached_append, -1);
rb_define_module_function(mLibwrap, "memcached_prepend", _wrap_memcached_prepend, -1);
rb_define_module_function(mLibwrap, "memcached_cas", _wrap_memcached_cas, -1);
rb_define_module_function(mLibwrap, "memcached_get", _wrap_memcached_get, -1);
rb_define_module_function(mLibwrap, "memcached_mget", _wrap_memcached_mget, -1);
rb_define_module_function(mLibwrap, "memcached_fetch", _wrap_memcached_fetch, -1);
rb_define_module_function(mLibwrap, "memcached_fetch_result", _wrap_memcached_fetch_result, -1);
rb_define_module_function(mLibwrap, "memcached_server_add_udp", _wrap_memcached_server_add_udp, -1);
rb_define_module_function(mLibwrap, "memcached_server_add_unix_socket", _wrap_memcached_server_add_unix_socket, -1);
rb_define_module_function(mLibwrap, "memcached_server_add", _wrap_memcached_server_add, -1);
rb_define_module_function(mLibwrap, "memcached_server_list_free", _wrap_memcached_server_list_free, -1);
rb_define_module_function(mLibwrap, "memcached_server_push", _wrap_memcached_server_push, -1);
rb_define_module_function(mLibwrap, "memcached_server_list_append", _wrap_memcached_server_list_append, -1);
rb_define_module_function(mLibwrap, "memcached_server_list_count", _wrap_memcached_server_list_count, -1);
rb_define_module_function(mLibwrap, "memcached_servers_parse", _wrap_memcached_servers_parse, -1);
rb_define_module_function(mLibwrap, "memcached_stat_get_value", _wrap_memcached_stat_get_value, -1);
rb_define_module_function(mLibwrap, "memcached_stat_get_keys", _wrap_memcached_stat_get_keys, -1);
rb_define_module_function(mLibwrap, "memcached_get_by_key", _wrap_memcached_get_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_mget_by_key", _wrap_memcached_mget_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_set_by_key", _wrap_memcached_set_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_add_by_key", _wrap_memcached_add_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_replace_by_key", _wrap_memcached_replace_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_prepend_by_key", _wrap_memcached_prepend_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_append_by_key", _wrap_memcached_append_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_cas_by_key", _wrap_memcached_cas_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_delete_by_key", _wrap_memcached_delete_by_key, -1);
rb_define_module_function(mLibwrap, "memcached_fetch_execute", _wrap_memcached_fetch_execute, -1);
rb_define_module_function(mLibwrap, "memcached_callback_set", _wrap_memcached_callback_set, -1);
rb_define_module_function(mLibwrap, "memcached_callback_get", _wrap_memcached_callback_get, -1);
rb_define_module_function(mLibwrap, "memcached_result_free", _wrap_memcached_result_free, -1);
rb_define_module_function(mLibwrap, "memcached_result_create", _wrap_memcached_result_create, -1);
rb_define_module_function(mLibwrap, "memcached_result_value", _wrap_memcached_result_value, -1);
rb_define_module_function(mLibwrap, "memcached_result_length", _wrap_memcached_result_length, -1);
rb_define_module_function(mLibwrap, "memcached_get_ruby_string", _wrap_memcached_get_ruby_string, -1);
rb_define_module_function(mLibwrap, "memcached_select_server_at", _wrap_memcached_select_server_at, -1);
rb_define_module_function(mLibwrap, "memcached_select_stat_at", _wrap_memcached_select_stat_at, -1);
rb_define_module_function(mRlibmemcached, "memcached_lib_version", _wrap_memcached_lib_version, -1);
rb_define_module_function(mRlibmemcached, "memcached_create", _wrap_memcached_create, -1);
rb_define_module_function(mRlibmemcached, "memcached_free", _wrap_memcached_free, -1);
rb_define_module_function(mRlibmemcached, "memcached_clone", _wrap_memcached_clone, -1);
rb_define_module_function(mRlibmemcached, "memcached_delete", _wrap_memcached_delete, -1);
rb_define_module_function(mRlibmemcached, "memcached_increment", _wrap_memcached_increment, -1);
rb_define_module_function(mRlibmemcached, "memcached_decrement", _wrap_memcached_decrement, -1);
rb_define_module_function(mRlibmemcached, "memcached_stat_free", _wrap_memcached_stat_free, -1);
rb_define_module_function(mRlibmemcached, "memcached_stat", _wrap_memcached_stat, -1);
rb_define_module_function(mRlibmemcached, "memcached_stat_servername", _wrap_memcached_stat_servername, -1);
rb_define_module_function(mRlibmemcached, "memcached_flush", _wrap_memcached_flush, -1);
rb_define_module_function(mRlibmemcached, "memcached_verbosity", _wrap_memcached_verbosity, -1);
rb_define_module_function(mRlibmemcached, "memcached_quit", _wrap_memcached_quit, -1);
rb_define_module_function(mRlibmemcached, "memcached_strerror", _wrap_memcached_strerror, -1);
rb_define_module_function(mRlibmemcached, "memcached_behavior_set", _wrap_memcached_behavior_set, -1);
rb_define_module_function(mRlibmemcached, "memcached_behavior_get", _wrap_memcached_behavior_get, -1);
rb_define_module_function(mRlibmemcached, "memcached_set", _wrap_memcached_set, -1);
rb_define_module_function(mRlibmemcached, "memcached_add", _wrap_memcached_add, -1);
rb_define_module_function(mRlibmemcached, "memcached_replace", _wrap_memcached_replace, -1);
rb_define_module_function(mRlibmemcached, "memcached_append", _wrap_memcached_append, -1);
rb_define_module_function(mRlibmemcached, "memcached_prepend", _wrap_memcached_prepend, -1);
rb_define_module_function(mRlibmemcached, "memcached_cas", _wrap_memcached_cas, -1);
rb_define_module_function(mRlibmemcached, "memcached_get", _wrap_memcached_get, -1);
rb_define_module_function(mRlibmemcached, "memcached_mget", _wrap_memcached_mget, -1);
rb_define_module_function(mRlibmemcached, "memcached_fetch", _wrap_memcached_fetch, -1);
rb_define_module_function(mRlibmemcached, "memcached_fetch_result", _wrap_memcached_fetch_result, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_add_udp", _wrap_memcached_server_add_udp, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_add_unix_socket", _wrap_memcached_server_add_unix_socket, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_add", _wrap_memcached_server_add, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_list_free", _wrap_memcached_server_list_free, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_push", _wrap_memcached_server_push, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_list_append", _wrap_memcached_server_list_append, -1);
rb_define_module_function(mRlibmemcached, "memcached_server_list_count", _wrap_memcached_server_list_count, -1);
rb_define_module_function(mRlibmemcached, "memcached_servers_parse", _wrap_memcached_servers_parse, -1);
rb_define_module_function(mRlibmemcached, "memcached_stat_get_value", _wrap_memcached_stat_get_value, -1);
rb_define_module_function(mRlibmemcached, "memcached_stat_get_keys", _wrap_memcached_stat_get_keys, -1);
rb_define_module_function(mRlibmemcached, "memcached_get_by_key", _wrap_memcached_get_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_mget_by_key", _wrap_memcached_mget_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_set_by_key", _wrap_memcached_set_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_add_by_key", _wrap_memcached_add_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_replace_by_key", _wrap_memcached_replace_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_prepend_by_key", _wrap_memcached_prepend_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_append_by_key", _wrap_memcached_append_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_cas_by_key", _wrap_memcached_cas_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_delete_by_key", _wrap_memcached_delete_by_key, -1);
rb_define_module_function(mRlibmemcached, "memcached_fetch_execute", _wrap_memcached_fetch_execute, -1);
rb_define_module_function(mRlibmemcached, "memcached_callback_set", _wrap_memcached_callback_set, -1);
rb_define_module_function(mRlibmemcached, "memcached_callback_get", _wrap_memcached_callback_get, -1);
rb_define_module_function(mRlibmemcached, "memcached_result_free", _wrap_memcached_result_free, -1);
rb_define_module_function(mRlibmemcached, "memcached_result_create", _wrap_memcached_result_create, -1);
rb_define_module_function(mRlibmemcached, "memcached_result_value", _wrap_memcached_result_value, -1);
rb_define_module_function(mRlibmemcached, "memcached_result_length", _wrap_memcached_result_length, -1);
rb_define_module_function(mRlibmemcached, "memcached_get_ruby_string", _wrap_memcached_get_ruby_string, -1);
rb_define_module_function(mRlibmemcached, "memcached_select_server_at", _wrap_memcached_select_server_at, -1);
rb_define_module_function(mRlibmemcached, "memcached_select_stat_at", _wrap_memcached_select_stat_at, -1);
}

Просмотреть файл

@ -1,5 +1,5 @@
require 'libmemcached'
require 'rlibmemcached'
require 'memcached/integer'
require 'memcached/exceptions'
require 'memcached/behaviors'
@ -11,14 +11,14 @@ The generated SWIG module for accessing libmemcached's C API.
Includes the full set of libmemcached static methods (as defined in <tt>$INCLUDE_PATH/libmemcached/memcached.h</tt>), and classes for the available structs:
* <b>Libmemcached::MemcachedResultSt</b>
* <b>Libmemcached::MemcachedServerSt</b>
* <b>Libmemcached::MemcachedSt</b>
* <b>Libmemcached::MemcachedStatSt</b>
* <b>Libmemcached::MemcachedStringSt</b>
* <b>Rlibmemcached::MemcachedResultSt</b>
* <b>Rlibmemcached::MemcachedServerSt</b>
* <b>Rlibmemcached::MemcachedSt</b>
* <b>Rlibmemcached::MemcachedStatSt</b>
* <b>Rlibmemcached::MemcachedStringSt</b>
A number of SWIG typemaps and C helper methods are also defined in <tt>ext/libmemcached.i</tt>.
=end
module Libmemcached
module Rlibmemcached
end

Просмотреть файл

@ -4,8 +4,8 @@ class Memcached
#:stopdoc:
def self.load_constants(prefix, hash = {}, offset = 0)
Libmemcached.constants.grep(/^#{prefix}/).each do |const_name|
hash[const_name[prefix.length..-1].downcase.to_sym] = Libmemcached.const_get(const_name) + offset
Rlibmemcached.constants.grep(/^#{prefix}/).each do |const_name|
hash[const_name[prefix.length..-1].downcase.to_sym] = Rlibmemcached.const_get(const_name) + offset
end
hash
end
@ -42,8 +42,8 @@ class Memcached
# STDERR.puts "Setting #{behavior}:#{b_id} => #{value}:#{v_id}"
unless value == false
# XXX Setting false still turns on the behavior; maybe a Libmemcached bug
Libmemcached.memcached_behavior_set(@struct, b_id, v_id)
# XXX Setting false still turns on the behavior; maybe a Rlibmemcached bug
Rlibmemcached.memcached_behavior_set(@struct, b_id, v_id)
end
end

Просмотреть файл

@ -58,12 +58,12 @@ Subclasses correspond one-to-one with server response strings or libmemcached er
end
EXCEPTIONS = []
EMPTY_STRUCT = Libmemcached::MemcachedSt.new
Libmemcached.memcached_create(EMPTY_STRUCT)
EMPTY_STRUCT = Rlibmemcached::MemcachedSt.new
Rlibmemcached.memcached_create(EMPTY_STRUCT)
# Generate exception classes
Libmemcached::MEMCACHED_MAXIMUM_RETURN.times do |index|
description = Libmemcached.memcached_strerror(EMPTY_STRUCT, index)
Rlibmemcached::MEMCACHED_MAXIMUM_RETURN.times do |index|
description = Rlibmemcached.memcached_strerror(EMPTY_STRUCT, index)
exception_class = eval("class #{camelize(description)} < Error; self; end")
EXCEPTIONS << exception_class
end

Просмотреть файл

@ -42,8 +42,8 @@ Please note that when non-blocking IO is enabled, setter and deleter methods do
=end
def initialize(servers, opts = {})
@struct = Libmemcached::MemcachedSt.new
Libmemcached.memcached_create(@struct)
@struct = Rlibmemcached::MemcachedSt.new
Rlibmemcached.memcached_create(@struct)
# Servers
Array(servers).each_with_index do |server, index|
@ -51,7 +51,7 @@ Please note that when non-blocking IO is enabled, setter and deleter methods do
raise ArgumentError, "Servers must be in the format ip:port (e.g., '127.0.0.1:11211')"
end
host, port = server.split(":")
Libmemcached.memcached_server_add(@struct, host, port.to_i)
Rlibmemcached.memcached_server_add(@struct, host, port.to_i)
end
# Behaviors
@ -84,7 +84,7 @@ Return the array of server strings used to configure this instance.
#
# <tt>clone</tt> is useful for threading, since each thread must have its own unshared Memcached object.
def clone
# XXX Could be more efficient if we used Libmemcached.memcached_clone(@struct)
# XXX Could be more efficient if we used Rlibmemcached.memcached_clone(@struct)
self.class.new(servers, options)
end
@ -100,7 +100,7 @@ Return the array of server strings used to configure this instance.
def server_structs
array = []
@struct.hosts.count.times do |i|
array << Libmemcached.memcached_select_server_at(@struct, i)
array << Rlibmemcached.memcached_select_server_at(@struct, i)
end
array
end
@ -120,7 +120,7 @@ Return the array of server strings used to configure this instance.
def set(key, value, timeout=0, marshal=true)
value = marshal ? Marshal.dump(value) : value.to_s
check_return_code(
Libmemcached.memcached_set(@struct, ns(key), value, timeout, FLAGS)
Rlibmemcached.memcached_set(@struct, ns(key), value, timeout, FLAGS)
)
end
@ -128,7 +128,7 @@ Return the array of server strings used to configure this instance.
def add(key, value, timeout=0, marshal=true)
value = marshal ? Marshal.dump(value) : value.to_s
check_return_code(
Libmemcached.memcached_add(@struct, ns(key), value, timeout, FLAGS)
Rlibmemcached.memcached_add(@struct, ns(key), value, timeout, FLAGS)
)
end
@ -138,14 +138,14 @@ Return the array of server strings used to configure this instance.
#
# Note that the key must be initialized to an unmarshalled integer first, via <tt>set</tt>, <tt>add</tt>, or <tt>replace</tt> with <tt>marshal</tt> set to <tt>false</tt>.
def increment(key, offset=1)
ret, value = Libmemcached.memcached_increment(@struct, ns(key), offset)
ret, value = Rlibmemcached.memcached_increment(@struct, ns(key), offset)
check_return_code(ret)
value
end
# Decrement a key's value. The parameters and exception behavior are the same as <tt>increment</tt>.
def decrement(key, offset=1)
ret, value = Libmemcached.memcached_decrement(@struct, ns(key), offset)
ret, value = Rlibmemcached.memcached_decrement(@struct, ns(key), offset)
check_return_code(ret)
value
end
@ -159,7 +159,7 @@ Return the array of server strings used to configure this instance.
def replace(key, value, timeout=0, marshal=true)
value = marshal ? Marshal.dump(value) : value.to_s
check_return_code(
Libmemcached.memcached_replace(@struct, ns(key), value, timeout, FLAGS)
Rlibmemcached.memcached_replace(@struct, ns(key), value, timeout, FLAGS)
)
end
@ -169,7 +169,7 @@ Return the array of server strings used to configure this instance.
def append(key, value)
# Requires memcached 1.2.4
check_return_code(
Libmemcached.memcached_append(@struct, ns(key), value.to_s, IGNORED, FLAGS)
Rlibmemcached.memcached_append(@struct, ns(key), value.to_s, IGNORED, FLAGS)
)
end
@ -177,7 +177,7 @@ Return the array of server strings used to configure this instance.
def prepend(key, value)
# Requires memcached 1.2.4
check_return_code(
Libmemcached.memcached_prepend(@struct, ns(key), value.to_s, IGNORED, FLAGS)
Rlibmemcached.memcached_prepend(@struct, ns(key), value.to_s, IGNORED, FLAGS)
)
end
@ -199,7 +199,7 @@ Return the array of server strings used to configure this instance.
# Deletes a key/value pair from the server. Accepts a String <tt>key</tt>. Raises <b>Memcached::NotFound</b> if the key does not exist.
def delete(key)
check_return_code(
Libmemcached.memcached_delete(@struct, ns(key), IGNORED)
Rlibmemcached.memcached_delete(@struct, ns(key), IGNORED)
)
end
@ -228,7 +228,7 @@ Return the array of server strings used to configure this instance.
# XXX Server doesn't validate keys. Regex is possibly a performance problem.
raise ClientError, "Invalid key" if key =~ /\s/
value, flags, ret = Libmemcached.memcached_get_ruby_string(@struct, ns(key))
value, flags, ret = Rlibmemcached.memcached_get_ruby_string(@struct, ns(key))
check_return_code(ret)
value = Marshal.load(value) if marshal
value
@ -241,18 +241,18 @@ Return the array of server strings used to configure this instance.
def stats
stats = Hash.new([])
stat_struct, ret = Libmemcached.memcached_stat(@struct, "")
stat_struct, ret = Rlibmemcached.memcached_stat(@struct, "")
check_return_code(ret)
keys, ret = Libmemcached.memcached_stat_get_keys(@struct, stat_struct)
keys, ret = Rlibmemcached.memcached_stat_get_keys(@struct, stat_struct)
check_return_code(ret)
keys.each do |key|
server_structs.size.times do |index|
value, ret = Libmemcached.memcached_stat_get_value(
value, ret = Rlibmemcached.memcached_stat_get_value(
@struct,
Libmemcached.memcached_select_stat_at(@struct, stat_struct, index),
Rlibmemcached.memcached_select_stat_at(@struct, stat_struct, index),
key)
check_return_code(ret)
@ -266,7 +266,7 @@ Return the array of server strings used to configure this instance.
end
end
Libmemcached.memcached_stat_free(@struct, stat_struct)
Rlibmemcached.memcached_stat_free(@struct, stat_struct)
stats
end
@ -279,7 +279,7 @@ Return the array of server strings used to configure this instance.
"#{@namespace}#{key}"
end
# Checks the return code from Libmemcached against the exception list. Raises the corresponding exception if the return code is not Memcached::Success or Memcached::ActionQueued. Accepts an integer return code.
# Checks the return code from Rlibmemcached against the exception list. Raises the corresponding exception if the return code is not Memcached::Success or Memcached::ActionQueued. Accepts an integer return code.
def check_return_code(ret) #:doc:
# 0.14 returns 0 for an ActionQueued result but 0.15 does not.
return if ret == 0 or ret == 31

Просмотреть файл

@ -3,6 +3,6 @@ require "#{File.dirname(__FILE__)}/../test_helper"
class BindingTest < Test::Unit::TestCase
def test_libmemcached_loaded
assert_nothing_raised { Libmemcached }
assert_nothing_raised { Rlibmemcached }
end
end

Просмотреть файл

@ -82,7 +82,7 @@ class MemcachedTest < Test::Unit::TestCase
def test_get_with_namespace
@cache.set key, @value
result = @cache.get key, false
direct_result = Libmemcached.memcached_get(
direct_result = Rlibmemcached.memcached_get(
@cache.instance_variable_get("@struct"),
"#{@namespace}#{key}"
).first
@ -106,7 +106,7 @@ class MemcachedTest < Test::Unit::TestCase
value = OpenStruct.new(:a => Object.new) # Marshals with a null \000
@cache.set key, value
result = @cache.get key, false
non_wrapped_result = Libmemcached.memcached_get(
non_wrapped_result = Rlibmemcached.memcached_get(
@cache.instance_variable_get("@struct"),
"#{@namespace}#{key}"
).first
@ -347,7 +347,7 @@ class MemcachedTest < Test::Unit::TestCase
assert_nothing_raised do
cache.set key, @value
end
ret = Libmemcached.memcached_set(
ret = Rlibmemcached.memcached_set(
cache.instance_variable_get("@struct"),
"#{@namespace}#{key}",
@marshalled_value,
@ -361,7 +361,7 @@ class MemcachedTest < Test::Unit::TestCase
assert_nothing_raised do
@nb_cache.set key, @value
end
ret = Libmemcached.memcached_set(
ret = Rlibmemcached.memcached_set(
@nb_cache.instance_variable_get("@struct"),
"#{@namespace}#{key}",
@marshalled_value,