本文整理汇总了Java中com.thimbleware.jmemcached.LocalCacheElement.setData方法的典型用法代码示例。如果您正苦于以下问题:Java LocalCacheElement.setData方法的具体用法?Java LocalCacheElement.setData怎么用?Java LocalCacheElement.setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thimbleware.jmemcached.LocalCacheElement
的用法示例。
在下文中一共展示了LocalCacheElement.setData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remove
import com.thimbleware.jmemcached.LocalCacheElement; //导入方法依赖的package包/类
public final LocalCacheElement remove(Object key) {
if (!(key instanceof Key)) return null;
StoredValue val = index.get(key);
if (val != null) {
LocalCacheElement el = val.toElement((Key) key);
lockWrite(val);
val.free();
unlockWrite(val);
el.setData(val.getData());
index.remove(key);
return el;
} else
return null;
}
示例2: get
import com.thimbleware.jmemcached.LocalCacheElement; //导入方法依赖的package包/类
@Override
public LocalCacheElement get(String keystring) {
try {
if (keystring.indexOf("_") == -1) {
return getProtocol(keystring);
}
String[] clientInfo = QueueClient.parseWithCache(keystring);
if (valid(clientInfo[0], clientInfo[1])) {
byte[] data;
data = getClientQueue(clientInfo[0]).poll();
if (data != null) {
LocalCacheElement element = new LocalCacheElement(keystring, 0, 0, 0);
element.setData(data);
return element;
} else {
log.info("queue empty");
}
} else {
log.error("unvalid " + keystring);
throw new ClientException("Authorization error");
}
} catch (Exception e) {
log.error("get queue " + keystring + " error", e);
return null;
}
return null;
}
示例3: element
import com.thimbleware.jmemcached.LocalCacheElement; //导入方法依赖的package包/类
private LocalCacheElement element(final String key1, final String value1) {
final LocalCacheElement e = new LocalCacheElement(new Key(copiedBuffer(key1, UTF_8)));
e.setData(copiedBuffer(value1, UTF_8));
return e;
}
示例4: toElement
import com.thimbleware.jmemcached.LocalCacheElement; //导入方法依赖的package包/类
public final LocalCacheElement toElement(Key key) {
final LocalCacheElement element = new LocalCacheElement(key, flags, expire, casUnique);
element.setData(getData());
return element;
}