1,220
社区成员
发帖
与我相关
我的任务
分享
public static MemcachedClient createMemcachedClient() throws IOException {
AuthDescriptor ad = new AuthDescriptor(new String[]{"PLAIN"}, new PlainCallbackHandler(username, password));
return new MemcachedClient(
new ConnectionFactoryBuilder().setProtocol(Protocol.BINARY)
.setAuthDescriptor(ad)
.build(),
AddrUtil.getAddresses(host + ":" + port));
}
MemcachedClient cache = MemcachedClientTool.createMemcachedClient();//缓存
OperationFuture<Boolean> bool=(OperationFuture<Boolean>)cache.set(accessTokenCode,EXPIRE_TIME,accessTokenCode);
//判断token是否入库成功
System.out.println(bool.get()+"---------------->"+cache.get(accessTokenCode));