使用阿里云OCS存放数据,但拿出的为空!!!

海澜百丈冰 2016-07-25 03:23:19
现在我想用阿里云的OCS存放token,但是每次都用key去拿都为null。
以下是我通过阿里云官网案例封装MemcachedClient 。
	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));

打印出来的是true,但是拿到的值为null。这是为什么,请各位大神指点一二。
...全文
966 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,220

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧