Memcached 简明教程
Memcached - Environment
Installing Memcached on Ubuntu
要在 Ubuntu 上安装 Memcached,请进入终端并键入以下命令:
To install Memcached on Ubuntu, go to terminal and type the following commands −
$sudo apt-get update
$sudo apt-get install memcached
Confirming Memcached Installation
要确认 Memcached 是否已安装,您需要运行以下给定的命令。此命令表示 Memcached 正在默认端口 11211 上运行。
To confirm if Memcached is installed or not, you need to run the command given below. This command shows that Memcached is running on the default port 11211.
$ps aux | grep memcached
要在不同的端口上运行 Memcached 服务器,请执行下面给出的命令。此命令在 TCP 端口 11111 上启动服务器,并在 UDP 端口 11111 上监听,作为一个守护进程。
To run Memcached server on a different port, execute the command given below. This command starts the server on the TCP port 11111 and listens on the UDP port 11111 as a daemon process.
$memcached -p 11111 -U 11111 -u user -d
您可以通过一次安装运行 memcached 服务器的多个实例。
You can run multiple instances of Memcached server through a single installation.
Memcached Java Environment Setup
在您的 Java 程序中使用 Memcached,您需要下载 * spymemcached-2.10.3.jar* ,并将此 jar 设置到类路径中。
To use Memcached in your Java program, you need to download spymemcached-2.10.3.jar and setup this jar into the classpath.