memcache基础操作模块。
依赖添加:
<dependency>
<groupId>com.zxy</groupId>
<artifactId>zxy-commons-memcache</artifactId>
<version>${zxy_commons_version}</version>
</dependency>
- memcache.properties配置:
#多个用逗号分隔
servers=172.28.28.50:11211
#连接池大小,建议:1
connectionPoolSize=1
#超时时间,单位:毫秒
connectTimeout=5000
- 使用:
MemcacheClient client = MemcacheFactory.getMemcacheClient();
client.set("xxx", "111");
请参考DEMO