本文整理汇总了Java中org.infinispan.client.hotrod.RemoteCache.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteCache.containsKey方法的具体用法?Java RemoteCache.containsKey怎么用?Java RemoteCache.containsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.infinispan.client.hotrod.RemoteCache
的用法示例。
在下文中一共展示了RemoteCache.containsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteRule
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
@Override
public String deleteRule(final String cidrAddress) {
try {
final RemoteCache<String, Rule> ruleCache = cacheManagerForIndexableCaches.getCache(SinkitCacheName.infinispan_rules.toString());
final ImmutablePair<String, String> startEndAddresses = CIDRUtils.getStartEndAddresses(cidrAddress);
final String clientIPAddressPaddedBigInt = startEndAddresses.getLeft();
log.log(Level.FINE, "Deleting key [" + cidrAddress + "] which actually translates to BigInteger zero padded representation " +
"[" + clientIPAddressPaddedBigInt + "]");
String response;
if (ruleCache.containsKey(clientIPAddressPaddedBigInt)) {
ruleCache.remove(clientIPAddressPaddedBigInt);
response = clientIPAddressPaddedBigInt + " DELETED";
} else {
response = clientIPAddressPaddedBigInt + " DOES NOT EXIST";
}
return response;
} catch (Exception e) {
log.log(Level.SEVERE, "deleteRule", e);
// TODO: Proper Error codes.
return null;
}
}
示例2: readSLAMessage
import org.infinispan.client.hotrod.RemoteCache; //导入方法依赖的package包/类
public SLAMessage readSLAMessage(String key) {
RemoteCache<String, SLAMessage> cache = remoteCacheManager.getSlaMessageCache();
if ( cache.containsKey(key) ) {
return cache.get(key);
} else {
return null;
}
}