![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_16461961388.webp)
Developing a
memcached
Application
1368
Hello world
shell> memrm --servers=localhost hwkey
shell> memcat --servers=localhost hwkey
•
memslap
: Test the load on one or more
memcached
servers, simulating get/set and multiple client
operations. For example, you can simulate the load of 100 clients performing get operations:
shell> memslap --servers=localhost --concurrency=100 --flush --test=get
memslap --servers=localhost --concurrency=100 --flush --test=get Threads connecting to servers 100
Took 13.571 seconds to read data
•
memflush
: Flush (empty) the contents of the
memcached
cache.
shell> memflush --servers=localhost
15.6.3.4. Using MySQL and
memcached
with Perl
The
Cache::Memcached
module provides a native interface to the Memcache protocol, and provides
support for the core functions offered by
memcached
. Install the module using your operating system's
package management system, or using
CPAN
:
root-shell> perl -MCPAN -e 'install Cache::Memcached'
To use
memcached
from Perl through the
Cache::Memcached
module, first create a new
Cache::Memcached
object that defines the list of servers and other parameters for the connection.
The only argument is a hash containing the options for the cache interface. For example, to create a
new instance that uses three
memcached
servers:
use Cache::Memcached;
my $cache = new Cache::Memcached {
'servers' => [
'192.168.0.100:11211',
'192.168.0.101:11211',
'192.168.0.102:11211',
],
};
Note
When using the
Cache::Memcached
interface with multiple servers, the API
automatically performs certain operations across all the servers in the group.
For example, getting statistical information through
Cache::Memcached
returns a hash that contains data on a host-by-host basis, as well as
generalized statistics for all the servers in the group.
You can set additional properties on the cache object instance when it is created by specifying the
option as part of the option hash. Alternatively, you can use a corresponding method on the instance:
•
servers
or method
set_servers()
: Specifies the list of the servers to be used. The servers list
should be a reference to an array of servers, with each element as the address and port number
combination (separated by a colon). You can also specify a local connection through a UNIX socket
(for example
/tmp/sock/memcached
). To specify the server with a weight (indicating how much
more frequently the server should be used during hashing), specify an array reference with the
memcached
server instance and a weight number. Higher numbers give higher priority.
•
compress_threshold
or method
set_compress_threshold()
: Specifies the threshold when
values are compressed. Values larger than the specified number are automatically compressed
(using
zlib
) during storage and retrieval.
•
no_rehash
or method
set_norehash()
: Disables finding a new server if the original choice is
unavailable.
•
readonly
or method
set_readonly()
: Disables writes to the
memcached
servers.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...