memcached 1.7.0 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG +4 -0
- data/Manifest +2 -36
- data/README.rdoc +2 -2
- data/Rakefile +1 -0
- data/ext/extconf.rb +1 -1
- data/ext/lib64/libmemcached.la +41 -0
- data/ext/lib64/pkgconfig/libmemcached.pc +10 -0
- data/ext/libmemcached-0.32/Makefile.am +1 -1
- data/ext/libmemcached-0.32/Makefile.in +242 -162
- data/ext/libmemcached-0.32/aclocal.m4 +533 -342
- data/ext/libmemcached-0.32/config.h.in +5 -3
- data/ext/libmemcached-0.32/configure +449 -431
- data/ext/libmemcached-0.32/configure.ac +0 -2
- data/memcached.gemspec +0 -0
- data/memcached.pem +16 -16
- metadata +26 -59
- metadata.gz.sig +0 -0
- data/ext/libmemcached-0.32/docs/Makefile.am +0 -415
- data/ext/libmemcached-0.32/docs/Makefile.in +0 -920
- data/ext/libmemcached-0.32/docs/libmemcached.pod +0 -123
- data/ext/libmemcached-0.32/docs/libmemcached_examples.pod +0 -115
- data/ext/libmemcached-0.32/docs/libmemcachedutil.pod +0 -40
- data/ext/libmemcached-0.32/docs/memcached_analyze.pod +0 -52
- data/ext/libmemcached-0.32/docs/memcached_auto.pod +0 -97
- data/ext/libmemcached-0.32/docs/memcached_behavior.pod +0 -224
- data/ext/libmemcached-0.32/docs/memcached_callback.pod +0 -123
- data/ext/libmemcached-0.32/docs/memcached_create.pod +0 -61
- data/ext/libmemcached-0.32/docs/memcached_delete.pod +0 -54
- data/ext/libmemcached-0.32/docs/memcached_dump.pod +0 -53
- data/ext/libmemcached-0.32/docs/memcached_flush.pod +0 -46
- data/ext/libmemcached-0.32/docs/memcached_flush_buffers.pod +0 -42
- data/ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod +0 -57
- data/ext/libmemcached-0.32/docs/memcached_get.pod +0 -161
- data/ext/libmemcached-0.32/docs/memcached_memory_allocators.pod +0 -73
- data/ext/libmemcached-0.32/docs/memcached_pool.pod +0 -77
- data/ext/libmemcached-0.32/docs/memcached_quit.pod +0 -47
- data/ext/libmemcached-0.32/docs/memcached_sasl.pod +0 -63
- data/ext/libmemcached-0.32/docs/memcached_server_st.pod +0 -75
- data/ext/libmemcached-0.32/docs/memcached_servers.pod +0 -102
- data/ext/libmemcached-0.32/docs/memcached_set.pod +0 -187
- data/ext/libmemcached-0.32/docs/memcached_stats.pod +0 -82
- data/ext/libmemcached-0.32/docs/memcached_strerror.pod +0 -46
- data/ext/libmemcached-0.32/docs/memcached_user_data.pod +0 -49
- data/ext/libmemcached-0.32/docs/memcached_verbosity.pod +0 -41
- data/ext/libmemcached-0.32/docs/memcached_version.pod +0 -56
- data/ext/libmemcached-0.32/docs/memcat.pod +0 -37
- data/ext/libmemcached-0.32/docs/memcp.pod +0 -40
- data/ext/libmemcached-0.32/docs/memdump.pod +0 -31
- data/ext/libmemcached-0.32/docs/memerror.pod +0 -30
- data/ext/libmemcached-0.32/docs/memflush.pod +0 -35
- data/ext/libmemcached-0.32/docs/memrm.pod +0 -34
- data/ext/libmemcached-0.32/docs/memslap.pod +0 -33
- data/ext/libmemcached-0.32/docs/memstat.pod +0 -35
@@ -1,123 +0,0 @@
|
|
1
|
-
=head1 NAME
|
2
|
-
|
3
|
-
libmemcached - Client library for memcached
|
4
|
-
|
5
|
-
=head1 LIBRARY
|
6
|
-
|
7
|
-
C Client Library for memcached (libmemcached, -lmemcached)
|
8
|
-
|
9
|
-
=head1 SYNOPSIS
|
10
|
-
|
11
|
-
#include <memcached.h>
|
12
|
-
|
13
|
-
=head1 DESCRIPTION
|
14
|
-
|
15
|
-
"Memcached is a high-performance, distributed memory object caching
|
16
|
-
system, generic in nature, but intended for use in speeding up dynamic web
|
17
|
-
applications by alleviating database load." L<http://danga.com/memcached/>
|
18
|
-
|
19
|
-
B<libmemcached> is a small, thread-safe client library for the
|
20
|
-
memcached protocol. The code has all been written with an eye to allow
|
21
|
-
for both web and embedded usage. It handles the work behind routing
|
22
|
-
particular keys to specific servers that you specify (and values are
|
23
|
-
matched based on server order as supplied by you). It implements both
|
24
|
-
a modula and consistent method of object distribution.
|
25
|
-
|
26
|
-
There are multiple implemented routing and hashing methods. See the
|
27
|
-
memcached_behavior_set() manpage.
|
28
|
-
|
29
|
-
All operations are performed against a C<memcached_st> structure.
|
30
|
-
These structures can either be dynamically allocated or statically
|
31
|
-
allocated and then initialized by memcached_create(). Functions have been
|
32
|
-
written in order to encapsulate the C<memcached_st>. It is not
|
33
|
-
recommended that you operate directly against the structure.
|
34
|
-
|
35
|
-
Nearly all functions return a C<memcached_return> value.
|
36
|
-
This value can be translated to a printable string with memcached_strerror(3).
|
37
|
-
|
38
|
-
Partitioning based on keys is supported in the library. Using the key partioning
|
39
|
-
functions it is possible to group sets of object onto servers.
|
40
|
-
|
41
|
-
C<memcached_st> structures are thread-safe, but each thread must
|
42
|
-
contain its own structure (that is, if you want to share these among
|
43
|
-
threads you must provide your own locking). No global variables are
|
44
|
-
used in this library.
|
45
|
-
|
46
|
-
If you are working with GNU autotools you will want to add the following to
|
47
|
-
your configure.ac to properly include libmemcached in your application.
|
48
|
-
|
49
|
-
PKG_CHECK_MODULES(DEPS, libmemcached >= 0.8.0)
|
50
|
-
AC_SUBST(DEPS_CFLAGS)
|
51
|
-
AC_SUBST(DEPS_LIBS)
|
52
|
-
|
53
|
-
Some features of the library must be enabled through memcached_behavior_set().
|
54
|
-
|
55
|
-
Hope you enjoy it!
|
56
|
-
|
57
|
-
=head1 CONSTANTS
|
58
|
-
|
59
|
-
A number of constants have been provided for in the library.
|
60
|
-
|
61
|
-
=over 4
|
62
|
-
|
63
|
-
=item MEMCACHED_DEFAULT_PORT
|
64
|
-
|
65
|
-
The default port used by memcached(3).
|
66
|
-
|
67
|
-
=item MEMCACHED_MAX_KEY
|
68
|
-
|
69
|
-
Default maximum size of a key (which includes the null pointer). Master keys
|
70
|
-
have no limit, this only applies to keys used for storage.
|
71
|
-
|
72
|
-
=item MEMCACHED_MAX_KEY
|
73
|
-
|
74
|
-
Default size of key (which includes the null pointer).
|
75
|
-
|
76
|
-
=item MEMCACHED_MAX_HOST_LENGTH
|
77
|
-
|
78
|
-
Maximum allowed size of the hostname.
|
79
|
-
|
80
|
-
=item MEMCACHED_VERSION_STRING
|
81
|
-
|
82
|
-
String value of libmemcached version such as "1.23.4"
|
83
|
-
|
84
|
-
=item MEMCACHED_MAJOR_VERSION
|
85
|
-
|
86
|
-
Major version value. Such as 1.23.4, would be 1
|
87
|
-
|
88
|
-
=item MEMCACHED_MINOR_VERSION
|
89
|
-
|
90
|
-
Major version value. Such as 1.23.4, would be 23
|
91
|
-
|
92
|
-
=item MEMCACHED_MICRO_VERSION
|
93
|
-
|
94
|
-
Major version value. Such as 1.23.4, would be 4
|
95
|
-
|
96
|
-
|
97
|
-
=back
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
=head1 THREADS AND PROCESSES
|
102
|
-
|
103
|
-
When using threads or forked processes it is important to keep an instance
|
104
|
-
of C<memcached_st> per process or thread. Without creating your own locking
|
105
|
-
structures you can not share a single C<memcached_st>. You can though call
|
106
|
-
memcached_quit(3) on a C<memcached_st> and then use the resulting cloned
|
107
|
-
structure.
|
108
|
-
|
109
|
-
=head1 HOME
|
110
|
-
|
111
|
-
To find out more information please check:
|
112
|
-
L<http://tangent.org/552/libmemcached.html>
|
113
|
-
|
114
|
-
=head1 AUTHOR
|
115
|
-
|
116
|
-
Brian Aker, E<lt>brian@tangent.orgE<gt>
|
117
|
-
|
118
|
-
=head1 SEE ALSO
|
119
|
-
|
120
|
-
memcached(1) libmemcached_examples(3) libmemcached(1) memcat(1) memcp(1) memflush(1) memrm(1) memslap(1) memstat(1) memcached_fetch(3) memcached_replace(3) memcached_server_list_free(3) libmemcached_examples(3) memcached_clone(3) memcached_free(3) memcached_server_add(3) memcached_server_push(3) memcached_add(3) memcached_get(3) memcached_server_count(3) memcached_servers_parse(3) memcached_create(3) memcached_increment(3) memcached_server_list(3) memcached_set(3) memcached_decrement(3) memcached_mget(3) memcached_server_list_append(3) memcached_strerror(3) memcached_delete(3) memcached_quit(3) memcached_server_list_count(3) memcached_verbosity(3) memcached_server_add_unix_socket(3) memcached_result_create(3) memcached_result_free(3) memcached_result_key_value(3) memcached_result_key_length(3) memcached_result_value(3) memcached_result_length(3) memcached_result_flags(3) memcached_result_cas(3) memcached_result_st(3) memcached_append(3) memcached_prepend(3) memcached_fetch_result(3) memerror(1) memcached_get_by_key(3) memcached_mget_by_key(3) memcached_delete_by_key(3) memcached_fetch_execute(3) memcached_callback_get(3) memcached_callback_set(3) memcached_version(3) memcached_lib_version(3) memcached_result_set_value(3) memcached_dump(3) memdump(1) memcached_set_memory_allocators(3) memcached_get_memory_allocators(3) memcached_get_user_data(3) memcached_set_user_data(3)
|
121
|
-
|
122
|
-
=cut
|
123
|
-
|
@@ -1,115 +0,0 @@
|
|
1
|
-
=head1 NAME
|
2
|
-
|
3
|
-
libmemcached_examples - Examples for libmemcached
|
4
|
-
|
5
|
-
=head1 DESCRIPTION
|
6
|
-
|
7
|
-
For full examples, test cases are found in tests/*.c in the main
|
8
|
-
distribution. These are always up to date, and are used for each test run of
|
9
|
-
the library.
|
10
|
-
|
11
|
-
=head2 Creating and Freeing structure
|
12
|
-
|
13
|
-
memcached_st *memc;
|
14
|
-
memcached_return rc;
|
15
|
-
|
16
|
-
memc= memcached_create(NULL);
|
17
|
-
...do stuff...
|
18
|
-
memcached_free(memc);
|
19
|
-
|
20
|
-
The above code would create a connection and then free the connection when
|
21
|
-
finished.
|
22
|
-
|
23
|
-
=head2 Connecting to servers
|
24
|
-
|
25
|
-
memcached_server_st *servers;
|
26
|
-
memcached_st *memc= memcached_create(NULL);
|
27
|
-
char servername[]= "0.example.com";
|
28
|
-
|
29
|
-
servers= memcached_server_list_append(NULL, servername, 400, &rc);
|
30
|
-
|
31
|
-
for (x= 0; x < 20; x++)
|
32
|
-
{
|
33
|
-
char buffer[SMALL_STRING_LEN];
|
34
|
-
|
35
|
-
snprintf(buffer, SMALL_STRING_LEN, "%u.example.com", 400+x);
|
36
|
-
servers= memcached_server_list_append(servers, buffer, 401, &rc);
|
37
|
-
}
|
38
|
-
rc= memcached_server_push(memc, servers);
|
39
|
-
memcached_server_free(servers);
|
40
|
-
memcached_free(memc);
|
41
|
-
|
42
|
-
In the above code you create a C<memcached_st> object that you then feed in a
|
43
|
-
single host into. In the for loop you build a C<memcached_server_st>
|
44
|
-
pointer that you then later feed via memcached_server_push() into the
|
45
|
-
C<memcached_st> structure.
|
46
|
-
|
47
|
-
You can reuse the C<memcached_server_st> object with multile C<memcached_st>
|
48
|
-
structures.
|
49
|
-
|
50
|
-
=head2 Adding a value to the server
|
51
|
-
|
52
|
-
char *key= "foo";
|
53
|
-
char *value;
|
54
|
-
size_t value_length= 8191;
|
55
|
-
unsigned int x;
|
56
|
-
|
57
|
-
value = (char*)malloc(value_length);
|
58
|
-
assert(value);
|
59
|
-
|
60
|
-
for (x= 0; x < value_length; x++)
|
61
|
-
value[x] = (char) (x % 127);
|
62
|
-
|
63
|
-
for (x= 0; x < 1; x++)
|
64
|
-
{
|
65
|
-
rc= memcached_set(memc, key, strlen(key),
|
66
|
-
value, value_length,
|
67
|
-
(time_t)0, (uint32_t)0);
|
68
|
-
assert(rc == MEMCACHED_SUCCESS);
|
69
|
-
}
|
70
|
-
|
71
|
-
free(value);
|
72
|
-
|
73
|
-
It is best practice to always look at the return value of any operation.
|
74
|
-
|
75
|
-
=head2 Fetching multiple values
|
76
|
-
|
77
|
-
memcached_return rc;
|
78
|
-
char *keys[]= {"fudge", "son", "food"};
|
79
|
-
size_t key_length[]= {5, 3, 4};
|
80
|
-
unsigned int x;
|
81
|
-
uint32_t flags;
|
82
|
-
|
83
|
-
char return_key[MEMCACHED_MAX_KEY];
|
84
|
-
size_t return_key_length;
|
85
|
-
char *return_value;
|
86
|
-
size_t return_value_length;
|
87
|
-
|
88
|
-
rc= memcached_mget(memc, keys, key_length, 3);
|
89
|
-
|
90
|
-
x= 0;
|
91
|
-
while ((return_value= memcached_fetch(memc, return_key, &return_key_length,
|
92
|
-
&return_value_length, &flags, &rc)))
|
93
|
-
{
|
94
|
-
free(return_value);
|
95
|
-
x++;
|
96
|
-
}
|
97
|
-
|
98
|
-
Notice that you freed values returned from memcached_fetch(). The define
|
99
|
-
C<MEMCACHED_MAX_KEY> is provided for usage.
|
100
|
-
|
101
|
-
=head1 HOME
|
102
|
-
|
103
|
-
To find out more information please check:
|
104
|
-
L<http://tangent.org/552/libmemcached.html>
|
105
|
-
|
106
|
-
=head1 AUTHOR
|
107
|
-
|
108
|
-
Brian Aker, E<lt>brian@tangent.orgE<gt>
|
109
|
-
|
110
|
-
=head1 SEE ALSO
|
111
|
-
|
112
|
-
memcached(1)
|
113
|
-
|
114
|
-
=cut
|
115
|
-
|
@@ -1,40 +0,0 @@
|
|
1
|
-
=head1 NAME
|
2
|
-
|
3
|
-
libmemcachedutil - Utility library for libmemcached
|
4
|
-
|
5
|
-
=head1 LIBRARY
|
6
|
-
|
7
|
-
C Client Library containing utility functions for libmemcached (libmemcachedutil, -lmemcachedutil)
|
8
|
-
|
9
|
-
=head1 SYNOPSIS
|
10
|
-
|
11
|
-
cc [ flag ... ] file ... -lmemcachedutil
|
12
|
-
|
13
|
-
#include <libmemcached/memcached_util.h>
|
14
|
-
|
15
|
-
=head1 DESCRIPTION
|
16
|
-
|
17
|
-
B<libmemcachedutil> is a small and thread-safe client library that provides
|
18
|
-
extra functionality built on top of B<libmemcached>.
|
19
|
-
|
20
|
-
=head1 THREADS
|
21
|
-
|
22
|
-
Do not try to access an instance of C<memcached_st> from multiple threads
|
23
|
-
at the same time. If you want to access memcached from multiple threads
|
24
|
-
you should either clone the C<memcached_st>, or use the memcached pool
|
25
|
-
implementation. see memcached_pool_create(3).
|
26
|
-
|
27
|
-
=head1 HOME
|
28
|
-
|
29
|
-
To find out more information please check:
|
30
|
-
L<http://tangent.org/552/libmemcached.html>
|
31
|
-
|
32
|
-
=head1 AUTHOR
|
33
|
-
|
34
|
-
Trond Norbye, E<lt>trond.norbye@sun.comE<gt>
|
35
|
-
|
36
|
-
=head1 SEE ALSO
|
37
|
-
|
38
|
-
libmemcached(3) memcached_pool_create(3) memcached_pool_destroy(3) memcached_pool_pop(3) memcached_pool_push(3)
|
39
|
-
|
40
|
-
=cut
|
@@ -1,52 +0,0 @@
|
|
1
|
-
=head1 NAME
|
2
|
-
|
3
|
-
memcached_analyze - Analyze server information
|
4
|
-
|
5
|
-
=head1 LIBRARY
|
6
|
-
|
7
|
-
C Client Library for memcached (libmemcached, -lmemcached)
|
8
|
-
|
9
|
-
=head1 SYNOPSIS
|
10
|
-
|
11
|
-
#include <memcached.h>
|
12
|
-
|
13
|
-
memcached_analysis_st *memcached_analyze(memcached_st *ptr,
|
14
|
-
memcached_stat_st *stat,
|
15
|
-
memcached_return *error);
|
16
|
-
|
17
|
-
=head1 DESCRIPTION
|
18
|
-
|
19
|
-
libmemcached(3) has the ability to query a memcached server (or collection
|
20
|
-
of servers) for their current state. Queries to find state return a
|
21
|
-
C<memcached_analysis_st> structure. You are responsible for freeing this structure.
|
22
|
-
|
23
|
-
memcached_analyze() analyzes useful information based on the provided servers
|
24
|
-
and sets the result to the C<memcached_analysis_st> structure. The return value
|
25
|
-
must be freed by the calling application.
|
26
|
-
|
27
|
-
A command line tool, memstat(1) with the option --analyze, is provided so that
|
28
|
-
you do not have to write an application to use this method.
|
29
|
-
|
30
|
-
=head1 RETURN
|
31
|
-
|
32
|
-
A pointer to the allocated C<memcached_analysis_st> structure on success and
|
33
|
-
a NULL pointer on failure. You may inspect the error detail by checking the
|
34
|
-
C<memcached_return> value.
|
35
|
-
|
36
|
-
Any method returning a C<memcached_analysis_st> expects you to free the
|
37
|
-
memory allocated for it.
|
38
|
-
|
39
|
-
=head1 HOME
|
40
|
-
|
41
|
-
To find out more information please check:
|
42
|
-
L<http://tangent.org/552/libmemcached.html>
|
43
|
-
|
44
|
-
=head1 AUTHOR
|
45
|
-
|
46
|
-
Toru Maesaka, E<lt>dev@torum.netE<gt>
|
47
|
-
|
48
|
-
=head1 SEE ALSO
|
49
|
-
|
50
|
-
memcached(1) libmemcached(3) memcached_strerror(3)
|
51
|
-
|
52
|
-
=cut
|
@@ -1,97 +0,0 @@
|
|
1
|
-
=head1 NAME
|
2
|
-
|
3
|
-
memcached_increment, memcached_decrement,
|
4
|
-
memcached_increment_with_initial, memcached_decrement_with_initial - Manipulate
|
5
|
-
counters
|
6
|
-
|
7
|
-
=head1 LIBRARY
|
8
|
-
|
9
|
-
C Client Library for memcached (libmemcached, -lmemcached)
|
10
|
-
|
11
|
-
=head1 SYNOPSIS
|
12
|
-
|
13
|
-
#include <memcached.h>
|
14
|
-
|
15
|
-
memcached_return
|
16
|
-
memcached_increment (memcached_st *ptr,
|
17
|
-
const char *key, size_t key_length,
|
18
|
-
unsigned int offset,
|
19
|
-
uint64_t *value);
|
20
|
-
|
21
|
-
memcached_return
|
22
|
-
memcached_decrement (memcached_st *ptr,
|
23
|
-
const char *key, size_t key_length,
|
24
|
-
unsigned int offset,
|
25
|
-
uint64_t *value);
|
26
|
-
|
27
|
-
memcached_return
|
28
|
-
memcached_increment_with_initial (memcached_st *ptr,
|
29
|
-
const char *key,
|
30
|
-
size_t key_length,
|
31
|
-
uint64_t offset,
|
32
|
-
uint64_t initial,
|
33
|
-
time_t expiration,
|
34
|
-
uint64_t *value);
|
35
|
-
|
36
|
-
memcached_return
|
37
|
-
memcached_decrement_with_initial (memcached_st *ptr,
|
38
|
-
const char *key,
|
39
|
-
size_t key_length,
|
40
|
-
uint64_t offset,
|
41
|
-
uint64_t initial,
|
42
|
-
time_t expiration,
|
43
|
-
uint64_t *value);
|
44
|
-
|
45
|
-
=head1 DESCRIPTION
|
46
|
-
|
47
|
-
memcached(1) servers have the ability to increment and decrement keys
|
48
|
-
(overflow and underflow are not detected). This gives you the ability to use
|
49
|
-
memcached to generate shared sequences of values.
|
50
|
-
|
51
|
-
memcached_increment() takes a key and keylength and increments the value by
|
52
|
-
the offset passed to it. The value is then returned via the unsigned int
|
53
|
-
value pointer you pass to it.
|
54
|
-
|
55
|
-
memcached_decrement() takes a key and keylength and decrements the value by
|
56
|
-
the offset passed to it. The value is then returned via the unsigned int
|
57
|
-
value pointer you pass to it.
|
58
|
-
|
59
|
-
memcached_increment_with_initial() takes a key and keylength and increments
|
60
|
-
the value by the offset passed to it. If the object specified by key does
|
61
|
-
not exist, one of two things may happen: If the expiration value is
|
62
|
-
MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
|
63
|
-
expiration values, the operation will succeed by seeding the value for that
|
64
|
-
key with a initial value to expire with the provided expiration time. The
|
65
|
-
flags will be set to zero.The value is then returned via the unsigned int
|
66
|
-
value pointer you pass to it.
|
67
|
-
|
68
|
-
memcached_decrement_with_initial() takes a key and keylength and decrements
|
69
|
-
the value by the offset passed to it. If the object specified by key does
|
70
|
-
not exist, one of two things may happen: If the expiration value is
|
71
|
-
MEMCACHED_EXPIRATION_NOT_ADD, the operation will fail. For all other
|
72
|
-
expiration values, the operation will succeed by seeding the value for that
|
73
|
-
key with a initial value to expire with the provided expiration time. The
|
74
|
-
flags will be set to zero.The value is then returned via the unsigned int
|
75
|
-
value pointer you pass to it.
|
76
|
-
|
77
|
-
=head1 RETURN
|
78
|
-
|
79
|
-
A value of type C<memcached_return> is returned.
|
80
|
-
On success that value will be C<MEMCACHED_SUCCESS>.
|
81
|
-
Use memcached_strerror() to translate this value to a printable string.
|
82
|
-
|
83
|
-
=head1 HOME
|
84
|
-
|
85
|
-
To find out more information please check:
|
86
|
-
L<http://tangent.org/552/libmemcached.html>
|
87
|
-
|
88
|
-
=head1 AUTHOR
|
89
|
-
|
90
|
-
Brian Aker, E<lt>brian@tangent.orgE<gt>
|
91
|
-
|
92
|
-
=head1 SEE ALSO
|
93
|
-
|
94
|
-
memcached(1) libmemcached(3) memcached_strerror(3)
|
95
|
-
|
96
|
-
=cut
|
97
|
-
|
@@ -1,224 +0,0 @@
|
|
1
|
-
=head1 NAME
|
2
|
-
|
3
|
-
memcached_behavior_get, memcached_behavior_set - Manipulate behavior
|
4
|
-
|
5
|
-
=head1 LIBRARY
|
6
|
-
|
7
|
-
C Client Library for memcached (libmemcached, -lmemcached)
|
8
|
-
|
9
|
-
=head1 SYNOPSIS
|
10
|
-
|
11
|
-
#include <memcached.h>
|
12
|
-
|
13
|
-
uint64_t
|
14
|
-
memcached_behavior_get (memcached_st *ptr,
|
15
|
-
memcached_behavior flag);
|
16
|
-
|
17
|
-
memcached_return
|
18
|
-
memcached_behavior_set (memcached_st *ptr,
|
19
|
-
memcached_behavior flag,
|
20
|
-
uint64_t data);
|
21
|
-
|
22
|
-
=head1 DESCRIPTION
|
23
|
-
|
24
|
-
libmemcached(3) behavior can be modified by use memcached_behavior_set().
|
25
|
-
Default behavior is the library strives to be quick and accurate. Some
|
26
|
-
behavior, while being faster, can also result in not entirely accurate
|
27
|
-
behavior (for instance, memcached_set() will always respond with
|
28
|
-
C<MEMCACHED_SUCCESS>).
|
29
|
-
|
30
|
-
memcached_behavior_get() takes a behavior flag and returns whether or not
|
31
|
-
that behavior is currently enabled in the client.
|
32
|
-
|
33
|
-
memcached_behavior_set() changes the value of a particular option of the
|
34
|
-
client. It takes both a flag (listed below) and a value. For simple on or
|
35
|
-
off options you just need to pass in a value of 1. Calls to
|
36
|
-
memcached_behavior_set() will flush and reset all connections.
|
37
|
-
|
38
|
-
=over 4
|
39
|
-
|
40
|
-
=item MEMCACHED_BEHAVIOR_USE_UDP
|
41
|
-
|
42
|
-
Causes libmemcached(3) to use the UDP transport when communicating
|
43
|
-
with a memcached server. Not all I/O operations are supported
|
44
|
-
when this behavior is enababled. The following operations will return
|
45
|
-
C<MEMCACHED_NOT_SUPPORTED> when executed with the MEMCACHED_BEHAVIOR_USE_UDP
|
46
|
-
enabled: memcached_version(), memcached_stat(), memcached_get(),
|
47
|
-
memcached_get_by_key(), memcached_mget(), memcached_mget_by_key(),
|
48
|
-
memcached_fetch(), memcached_fetch_result(), memcached_value_fetch().
|
49
|
-
|
50
|
-
All other operations are supported but are executed in a 'fire-and-forget'
|
51
|
-
mode, in which once the client has executed the operation, no attempt
|
52
|
-
will be made to ensure the operation has been received and acted on by the
|
53
|
-
server.
|
54
|
-
|
55
|
-
libmemcached(3) does not allow TCP and UDP servers to be shared within
|
56
|
-
the same libmemached(3) client 'instance'. An attempt to add a TCP server
|
57
|
-
when this behavior is enabled will result in a C<MEMCACHED_INVALID_HOST_PROTOCOL>,
|
58
|
-
as will attempting to add a UDP server when this behavior has not been enabled.
|
59
|
-
|
60
|
-
=item MEMCACHED_BEHAVIOR_NO_BLOCK
|
61
|
-
|
62
|
-
Causes libmemcached(3) to use asychronous IO. This is the fastest transport
|
63
|
-
available for storage functions.
|
64
|
-
|
65
|
-
=item MEMCACHED_BEHAVIOR_SND_TIMEOUT
|
66
|
-
|
67
|
-
This sets the microsecond behavior of the socket against the SO_SNDTIMEO flag.
|
68
|
-
In cases where you cannot use non-blocking IO this will allow you to still have
|
69
|
-
timeouts on the sending of data.
|
70
|
-
|
71
|
-
=item MEMCACHED_BEHAVIOR_RCV_TIMEOUT
|
72
|
-
|
73
|
-
This sets the microsecond behavior of the socket against the SO_RCVTIMEO flag.
|
74
|
-
In cases where you cannot use non-blocking IO this will allow you to still have
|
75
|
-
timeouts on the reading of data.
|
76
|
-
|
77
|
-
=item MEMCACHED_BEHAVIOR_TCP_NODELAY
|
78
|
-
|
79
|
-
Turns on the no-delay feature for connecting sockets (may be faster in some
|
80
|
-
environments).
|
81
|
-
|
82
|
-
=item MEMCACHED_BEHAVIOR_HASH
|
83
|
-
|
84
|
-
Makes the default hashing algorithm for keys use MD5. The value can be set
|
85
|
-
to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, MEMCACHED_HASH_FNV1A_32, MEMCACHED_HASH_JENKINS, MEMCACHED_HASH_HSIEH, and MEMCACHED_HASH_MURMUR.
|
86
|
-
Each hash has it's advantages and it's weaknesses. If you dont know or dont care, just go with the default.
|
87
|
-
Support for MEMCACHED_HASH_HSIEH is a compile time option that is disabled by default. To enable support for this hashing algorithm, configure and build libmemcached with the --enable-hash_hsieh.
|
88
|
-
|
89
|
-
=item MEMCACHED_BEHAVIOR_DISTRIBUTION
|
90
|
-
|
91
|
-
Using this you can enable different means of distributing values to servers.
|
92
|
-
The default method is MEMCACHED_DISTRIBUTION_MODULA. You can enable
|
93
|
-
consistent hashing by setting MEMCACHED_DISTRIBUTION_CONSISTENT.
|
94
|
-
Consistent hashing delivers better distribution and allows servers to be
|
95
|
-
added to the cluster with minimal cache losses. Currently
|
96
|
-
MEMCACHED_DISTRIBUTION_CONSISTENT is an alias for the value
|
97
|
-
MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA.
|
98
|
-
|
99
|
-
=item MEMCACHED_BEHAVIOR_CACHE_LOOKUPS
|
100
|
-
|
101
|
-
Memcached can cache named lookups so that DNS lookups are made only once.
|
102
|
-
|
103
|
-
=item MEMCACHED_BEHAVIOR_SUPPORT_CAS
|
104
|
-
|
105
|
-
Support CAS operations (this is not enabled by default at this point in the server since it imposes a slight performance penalty).
|
106
|
-
|
107
|
-
=item MEMCACHED_BEHAVIOR_KETAMA
|
108
|
-
|
109
|
-
Sets the default distribution to MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA
|
110
|
-
and the hash to MEMCACHED_HASH_MD5.
|
111
|
-
|
112
|
-
=item MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED
|
113
|
-
|
114
|
-
Sets the default distribution to MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA with the weighted support.
|
115
|
-
and the hash to MEMCACHED_HASH_MD5.
|
116
|
-
|
117
|
-
=item MEMCACHED_BEHAVIOR_KETAMA_HASH
|
118
|
-
|
119
|
-
Sets the hashing algorithm for host mapping on continuum. The value can be set
|
120
|
-
to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, and MEMCACHED_HASH_FNV1A_32.
|
121
|
-
|
122
|
-
=item MEMCACHED_BEHAVIOR_POLL_TIMEOUT
|
123
|
-
|
124
|
-
Modify the timeout value that is used by poll(). The default value is -1. An signed int pointer must be passed to memcached_behavior_set() to change this value. For memcached_behavior_get() a signed int value will be cast and returned as the unsigned long long.
|
125
|
-
|
126
|
-
=item MEMCACHED_BEHAVIOR_USER_DATA
|
127
|
-
|
128
|
-
This allows you to store a pointer to a specifc piece of data. This can be
|
129
|
-
retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
|
130
|
-
|
131
|
-
will copy the pointer to the clone. This was deprecated in 0.14 in favor
|
132
|
-
of memcached_callback_set(3). This will be removed in 0.15.
|
133
|
-
|
134
|
-
=item MEMCACHED_BEHAVIOR_BUFFER_REQUESTS
|
135
|
-
|
136
|
-
Enabling buffered IO causes commands to "buffer" instead of being sent. Any
|
137
|
-
action that gets data causes this buffer to be be sent to the remote
|
138
|
-
connection. Quiting the connection or closing down the connection will also
|
139
|
-
cause the buffered data to be pushed to the remote connection.
|
140
|
-
|
141
|
-
=item MEMCACHED_BEHAVIOR_VERIFY_KEY
|
142
|
-
|
143
|
-
Enabling this will cause libmemcached(3) to test all keys to verify that they
|
144
|
-
are valid keys.
|
145
|
-
|
146
|
-
=item MEMCACHED_BEHAVIOR_SORT_HOSTS
|
147
|
-
|
148
|
-
Enabling this will cause hosts that are added to be placed in the host list in
|
149
|
-
sorted order. This will defeat consisten hashing.
|
150
|
-
|
151
|
-
=item MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
|
152
|
-
|
153
|
-
In non-blocking mode this changes the value of the timeout during socket
|
154
|
-
connection.
|
155
|
-
|
156
|
-
=item MEMCACHED_BEHAVIOR_BINARY_PROTOCOL
|
157
|
-
|
158
|
-
Enable the use of the binary protocol. Please note that you cannot toggle
|
159
|
-
this flag on an open connection.
|
160
|
-
|
161
|
-
=item MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
|
162
|
-
|
163
|
-
Set this value to enable the server be removed after continuous MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
|
164
|
-
times connection failure.
|
165
|
-
|
166
|
-
=item MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK
|
167
|
-
|
168
|
-
Set this value to tune the number of messages that may be sent before
|
169
|
-
libmemcached should start to automatically drain the input queue. Setting
|
170
|
-
this value to high, may cause libmemcached to deadlock (trying to send data,
|
171
|
-
but the send will block because the input buffer in the kernel is full).
|
172
|
-
|
173
|
-
=item MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK
|
174
|
-
|
175
|
-
Set this value to tune the number of bytes that may be sent before
|
176
|
-
libmemcached should start to automatically drain the input queue (need
|
177
|
-
at least 10 IO requests sent without reading the input buffer). Setting
|
178
|
-
this value to high, may cause libmemcached to deadlock (trying to send
|
179
|
-
data, but the send will block because the input buffer in the kernel is full).
|
180
|
-
|
181
|
-
=item MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH
|
182
|
-
|
183
|
-
The binary protocol works a bit different than the textual protocol in
|
184
|
-
that a multiget is implemented as a pipe of single get-operations which
|
185
|
-
are sent to the server in a chunk. If you are using large multigets from
|
186
|
-
your application, you may improve the latency of the gets by setting
|
187
|
-
this value so you send out the first chunk of requests when you hit the
|
188
|
-
specified limit. It allows the servers to start processing the requests
|
189
|
-
to send the data back while the rest of the requests are created and
|
190
|
-
sent to the server.
|
191
|
-
|
192
|
-
=item MEMCACHED_BEHAVIOR_NOREPLY
|
193
|
-
|
194
|
-
Set this value to specify that you really don't care about the result
|
195
|
-
from your storage commands (set, add, replace, append, prepend).
|
196
|
-
|
197
|
-
=back
|
198
|
-
|
199
|
-
=head1 RETURN
|
200
|
-
|
201
|
-
memcached_behavior_get() returns either the current value of the get, or 0
|
202
|
-
or 1 on simple flag behaviors (1 being enabled). memcached_behavior_set()
|
203
|
-
returns failure or success.
|
204
|
-
|
205
|
-
=head1 NOTES
|
206
|
-
|
207
|
-
memcached_behavior_set() in version .17 was changed from taking a pointer
|
208
|
-
to data value, to taking a uin64_t.
|
209
|
-
|
210
|
-
=head1 HOME
|
211
|
-
|
212
|
-
To find out more information please check:
|
213
|
-
L<http://tangent.org/552/libmemcached.html>
|
214
|
-
|
215
|
-
=head1 AUTHOR
|
216
|
-
|
217
|
-
Brian Aker, E<lt>brian@tangent.orgE<gt>
|
218
|
-
|
219
|
-
=head1 SEE ALSO
|
220
|
-
|
221
|
-
memcached(1) libmemcached(3) memcached_strerror(3)
|
222
|
-
|
223
|
-
=cut
|
224
|
-
|