标签:des style blog http io os 使用 ar strong
一、memcached 概述
Memcache(内存,缓存) : 是一个高性能的分布式的内存对象缓存系统。通过在内存里维护一个巨大的hash表。(key=value)
| key(键) | value(值) | 
| var1 | "123456" | 
| var2 | array(‘ab‘,‘cd‘) | 
| var3 | object值 | 
二、memcached 安装(windows)
1、下载 memcached 软件。 点击下载>>
2、将 memcached 软件拷贝到某个目录,最好放在 php 开发环境目录下,便于管理。
3、进入 windows 端的命令控制台,进入该目录下,安装 memcached.exe –d install [卸载使用 memcached.exe -d uninstall]
注:将 memcached 所在的目录添加到 Path 中,就可以在命令控制台中直接使用 memcached 命令了。具体操作请点击查看类似操作步骤。
4、启动/停止 memcached 服务,memcached -d start[stop]
若启动成功,可以在服务中看到:

5、memcached 的默认使用端口是:11211
特别说明:memcached 默认启动的最大内存为 64 M。如果需要的 memcached 的内存大于 64M,应当这样启动
三、memcached 的基本命令
安装、卸载、启动、配置相关
-p 监听的端口 
-l 连接的IP地址, 默认是本机  
-d start 启动memcached服务 
-d restart 重起memcached服务 
-d stop|shutdown 关闭正在运行的memcached服务 
-d install 安装memcached服务 
-d uninstall 卸载memcached服务 
-u 以的身份运行 (仅在以root运行的时候有效) 
-m 最大内存使用,单位MB。默认64MB 
-M 内存耗尽时返回错误,而不是删除项 
-c 最大同时连接数,默认是1024 
-f 块大小增长因子,默认是1.25 
-n 最小分配空间,key+value+flags默认是48 
-h 显示帮助
四、操作 memcached
telnet localhost 11211 --telnet memcached
| Command | Description | Example | 
| get | Reads a value | get mykey | 
| set | Set a key unconditionally | set mykey 0 60 5 | 
| add | Add a new key | add newkey 0 60 5 | 
| replace | Overwrite existing key | replace key 0 60 5 | 
| append | Append data to existing key | append key 0 60 15 | 
| prepend | Prepend data to existing key | prepend key 0 60 15 | 
| incr | Increments numerical key value by given number | incr mykey 2 | 
| decr | Decrements numerical key value by given number | decr mykey 5 | 
| delete | Deletes an existing key | delete mykey | 
| flush_all | Invalidate specific items immediately | flush_all | 
| Invalidate all items in n seconds | flush_all 900 | |
| stats | Prints general statistics | stats | 
| Prints memory statistics | stats slabs | |
| Prints memory statistics | stats malloc | |
| Print higher level allocation statistics | stats items | |
| stats detail | ||
| stats sizes | ||
| Resets statistics | stats reset | |
| version | Prints server version. | version | 
| verbosity | Increases log level | verbosity | 
| quit | Terminate telnet session | quit 
 | 
标签:des style blog http io os 使用 ar strong
原文地址:http://www.cnblogs.com/hllnj2008/p/3989647.html