1
# DROP FUNCTION IF EXISTS memc_servers_set;
2
# DROP FUNCTION IF EXISTS memc_set;
3
# DROP FUNCTION IF EXISTS memc_get;
4
# DROP FUNCTION IF EXISTS memc_delete;
5
# DROP FUNCTION IF EXISTS memc_append;
6
# DROP FUNCTION IF EXISTS memc_prepend;
7
# DROP FUNCTION IF EXISTS memc_behavior_set;
8
# DROP FUNCTION IF EXISTS memc_behavior_get;
10
# CREATE FUNCTION memc_servers_set RETURNS STRING SONAME "libmemcached_functions_mysql.so";
11
# CREATE FUNCTION memc_set RETURNS STRING SONAME "libmemcached_functions_mysql.so";
12
# CREATE FUNCTION memc_get RETURNS STRING SONAME "libmemcached_functions_mysql.so";
13
# CREATE FUNCTION memc_delete RETURNS STRING SONAME "libmemcached_functions_mysql.so";
14
# CREATE FUNCTION memc_append RETURNS STRING SONAME "libmemcached_functions_mysql.so";
15
# CREATE FUNCTION memc_prepend RETURNS STRING SONAME "libmemcached_functions_mysql.so";
16
# CREATE FUNCTION memc_behavior_set RETURNS STRING SONAME "libmemcached_functions_mysql.so";
17
# CREATE FUNCTION memc_behavior_get RETURNS STRING SONAME "libmemcached_functions_mysql.so";
19
DROP TABLE IF EXISTS `t1`;
20
select memc_servers_set('127.0.0.1:11211');
22
CREATE TABLE `t1` (id integer NOT NULL auto_increment primary key, bcol text);
23
INSERT INTO `t1` (bcol) values ('This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the following terms: You may create a printed copy of this documentation solely for your own personal use. Conversion to other formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute this documentation in any form or on any media, except if you distribute the documentation in a manner similar to how MySQL disseminates it (that is, electronically for download on a Web site with the software) or on a CD-ROM or similar medium, provided however that the documentation is disseminated together with the software on the same medium. Any other use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior written consent from an authorized representative of MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly granted above.');
24
select memc_set('mysql:doc1', bcol) from t1;
25
select memc_get('mysql:doc1');
27
select memc_delete('mysql:doc1');
28
select memc_get('mysql:doc1');
30
select memc_set('spot:test', ' Spot ');
31
select memc_get('spot:test');
32
select memc_prepend('spot:test', 'See');
33
select memc_get('spot:test');
34
select memc_append('spot:test', 'run.');
35
select memc_get('spot:test');
36
select memc_delete('spot:test');
38
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_NO_BLOCK');
40
select memc_behavior_set('MEMCACHED_BEHAVIOR_NO_BLOCK', '1');
41
select memc_behavior_get('MEMCACHED_BEHAVIOR_NO_BLOCK');
42
select memc_behavior_set('MEMCACHED_BEHAVIOR_NO_BLOCK', @behavior);
44
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_SUPPORT_CAS');
46
select memc_behavior_set('MEMCACHED_BEHAVIOR_SUPPORT_CAS', '1');
47
select memc_behavior_get('MEMCACHED_BEHAVIOR_SUPPORT_CAS');
48
select memc_behavior_set('MEMCACHED_BEHAVIOR_SUPPORT_CAS', @behavior);
50
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_TCP_NODELAY');
51
select memc_behavior_set('MEMCACHED_BEHAVIOR_TCP_NODELAY', '1');
52
select memc_behavior_get('MEMCACHED_BEHAVIOR_TCP_NODELAY');
53
select memc_behavior_set('MEMCACHED_BEHAVIOR_TCP_NODELAY', @behavior);
55
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
56
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', '1');
57
select memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
58
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', @behavior);
60
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_USER_DATA');
61
select memc_behavior_set('MEMCACHED_BEHAVIOR_USER_DATA', '1');
62
select memc_behavior_get('MEMCACHED_BEHAVIOR_USER_DATA');
63
select memc_behavior_set('MEMCACHED_BEHAVIOR_USER_DATA', @behavior);
65
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_SORT_HOSTS');
66
select memc_behavior_set('MEMCACHED_BEHAVIOR_SORT_HOSTS', '1');
67
select memc_behavior_get('MEMCACHED_BEHAVIOR_SORT_HOSTS');
68
select memc_behavior_set('MEMCACHED_BEHAVIOR_SORT_HOSTS', @behavior);
70
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_VERIFY_KEY');
71
select memc_behavior_set('MEMCACHED_BEHAVIOR_VERIFY_KEY', '1');
72
select memc_behavior_get('MEMCACHED_BEHAVIOR_VERIFY_KEY');
73
select memc_behavior_set('MEMCACHED_BEHAVIOR_VERIFY_KEY', @behavior);
75
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_KETAMA');
76
select memc_behavior_set('MEMCACHED_BEHAVIOR_KETAMA', '1');
77
select memc_behavior_get('MEMCACHED_BEHAVIOR_KETAMA');
79
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS');
80
select memc_behavior_set('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS', '1');
81
select memc_behavior_get('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS');
82
select memc_behavior_set('MEMCACHED_BEHAVIOR_CACHE_LOOKUPS', @behavior);
84
set @behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
85
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', '1');
86
select memc_behavior_get('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS');
87
select memc_behavior_set('MEMCACHED_BEHAVIOR_BUFFER_REQUESTS', @behavior);
89
set @preserve_behavior = memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
90
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_DEFAULT' );
91
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
93
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_MD5' );
94
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
96
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_CRC' );
97
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
99
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1_64' );
100
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
102
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1A_64' );
103
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
105
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1_32' );
106
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
108
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_FNV1A_32' );
109
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
111
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_JENKINS' );
112
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
114
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_HSIEH' );
115
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
117
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH','MEMCACHED_HASH_MURMUR' );
118
select memc_behavior_get('MEMCACHED_BEHAVIOR_HASH');
120
select memc_behavior_set('MEMCACHED_BEHAVIOR_HASH', @preserve_behavior);
122
set @preserve_dist= memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');
123
select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', 'MEMCACHED_DISTRIBUTION_MODULA');
124
select memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');
126
select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', 'MEMCACHED_DISTRIBUTION_CONSISTENT');
127
select memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');
129
select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', 'MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA');
130
select memc_behavior_get('MEMCACHED_BEHAVIOR_DISTRIBUTION');
131
select memc_behavior_set('MEMCACHED_BEHAVIOR_DISTRIBUTION', @preserve_dist);
133
set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE');
135
select memc_behavior_set('MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE', 60000);
136
select memc_behavior_get('MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE');
137
select memc_behavior_set('MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE', @size);
139
set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE');
141
select memc_behavior_set('MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE', 120000);
142
select memc_behavior_get('MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE');
143
select memc_behavior_set('MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE', @size);
145
set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_POLL_TIMEOUT');
147
select memc_behavior_set('MEMCACHED_BEHAVIOR_POLL_TIMEOUT', 100);
148
select memc_behavior_get('MEMCACHED_BEHAVIOR_POLL_TIMEOUT');
149
select memc_behavior_set('MEMCACHED_BEHAVIOR_POLL_TIMEOUT', @size);
152
set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT');
154
select memc_behavior_set('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT', 5);
155
select memc_behavior_get('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT');
156
select memc_behavior_set('MEMCACHED_BEHAVIOR_RETRY_TIMEOUT', @size);
158
set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK');
160
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK', 5);
161
select memc_behavior_get('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK');
162
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK', @size);
164
set @size = memc_behavior_get('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK');
166
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK', 5);
167
select memc_behavior_get('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK');
168
select memc_behavior_set('MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK', @size);