本文整理汇总了Java中org.elasticsearch.common.cache.Cache类的典型用法代码示例。如果您正苦于以下问题:Java Cache类的具体用法?Java Cache怎么用?Java Cache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cache类属于org.elasticsearch.common.cache包,在下文中一共展示了Cache类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onRemoval
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
@Override
public void onRemoval(RemovalNotification<Object, Cache<Query, Value>> notification) {
if (notification.getKey() == null) {
return;
}
Cache<Query, Value> valueCache = notification.getValue();
if (valueCache == null) {
return;
}
for (Value value : valueCache.values()) {
listener.onRemoval(value.shardId, value.bitset);
// if null then this means the shard has already been removed and the stats are 0 anyway for the shard this key belongs to
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:BitsetFilterCache.java
示例2: IndexFieldCache
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
IndexFieldCache(Logger logger,final Cache<Key, Accountable> cache, Index index, String fieldName, Listener... listeners) {
this.logger = logger;
this.listeners = listeners;
this.index = index;
this.fieldName = fieldName;
this.cache = cache;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:IndicesFieldDataCache.java
示例3: BitsetFilterCache
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
public BitsetFilterCache(IndexSettings indexSettings, Listener listener) {
super(indexSettings);
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
}
this.loadRandomAccessFiltersEagerly = this.indexSettings.getValue(INDEX_LOAD_RANDOM_ACCESS_FILTERS_EAGERLY_SETTING);
this.loadedFilters = CacheBuilder.<Object, Cache<Query, Value>>builder().removalListener(this).build();
this.listener = listener;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:BitsetFilterCache.java
示例4: getAndLoadIfNotPresent
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
private BitSet getAndLoadIfNotPresent(final Query query, final LeafReaderContext context) throws IOException, ExecutionException {
final Object coreCacheReader = context.reader().getCoreCacheKey();
final ShardId shardId = ShardUtils.extractShardId(context.reader());
if (shardId != null // can't require it because of the percolator
&& indexSettings.getIndex().equals(shardId.getIndex()) == false) {
// insanity
throw new IllegalStateException("Trying to load bit set for index " + shardId.getIndex()
+ " with cache of index " + indexSettings.getIndex());
}
Cache<Query, Value> filterToFbs = loadedFilters.computeIfAbsent(coreCacheReader, key -> {
context.reader().addCoreClosedListener(BitsetFilterCache.this);
return CacheBuilder.<Query, Value>builder().build();
});
return filterToFbs.computeIfAbsent(query, key -> {
final IndexReaderContext topLevelContext = ReaderUtil.getTopLevelContext(context);
final IndexSearcher searcher = new IndexSearcher(topLevelContext);
searcher.setQueryCache(null);
final Weight weight = searcher.createNormalizedWeight(query, false);
Scorer s = weight.scorer(context);
final BitSet bitSet;
if (s == null) {
bitSet = null;
} else {
bitSet = BitSet.of(s.iterator(), context.reader().maxDoc());
}
Value value = new Value(bitSet, shardId);
listener.onCache(shardId, value.bitset);
return value;
}).bitset;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:33,代码来源:BitsetFilterCache.java
示例5: cacheLoad
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
private <E extends Object> E cacheLoad(CacheKey key, Cache<CacheKey, E> cache,
CheckedFunction<String, E, IOException> loader) throws IOException {
try {
return cache.computeIfAbsent(key, (k) -> {
E elt = loader.apply(k.getId());
if (elt != null) {
onAdd(k, elt);
}
return elt;
});
} catch (ExecutionException e) {
throw new IOException(e.getMessage(), e.getCause());
}
}
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:15,代码来源:Caches.java
示例6: evict
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
private void evict(String index, Cache<CacheKey, ?> cache) {
Iterator<CacheKey> ite = cache.keys().iterator();
while(ite.hasNext()) {
if(ite.next().storeName.equals(index)) {
ite.remove();
}
}
}
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:9,代码来源:Caches.java
示例7: JoinerScript
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
protected JoinerScript(Client client, ESLogger logger, Cache<Tuple<String, String>, Map<String, Object>> cache,
String tenant, String index, String type, String id,
String docindex, String doctype, String docid,
String targetSource, String targetSourceIncludes, String targetSourceExcludes,
String targetSourceLwc, String missing,
String cacheField, String cachedField) {
this.client = client;
this.logger = logger;
this.cache = cache;
this.tenant = tenant;
this.index = index;
this.type = type;
this.id = id;
this.docid = docid;
this.doctype = doctype;
this.docindex = docindex;
this.targetSource = targetSource;
this.targetSourceIncludes = targetSourceIncludes;
this.targetSourceExcludes = targetSourceExcludes;
this.targetSourceLwc = targetSourceLwc;
if (missing == null || missing.equals("_last")) {
this.missingStringSortValue = "\u00ff\u00ff\u00ff\u00ff";
} else if (missing.equals("_first")) {
this.missingStringSortValue = "";
} else {
this.missingStringSortValue = missing;
}
this.cacheField = cacheField;
this.cachedField = cachedField;
}
开发者ID:sutoiku,项目名称:elasticsearch-native-script-joiner,代码行数:36,代码来源:JoinerScript.java
示例8: getCache
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
public Cache<Key, Accountable> getCache() {
return cache;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:IndicesFieldDataCache.java
示例9: getLoadedFilters
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
Cache<Object, Cache<Query, Value>> getLoadedFilters() {
return loadedFilters;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:BitsetFilterCache.java
示例10: featureCache
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
public Cache<CacheKey, Feature> featureCache() {
return featureCache;
}
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:4,代码来源:Caches.java
示例11: featureSetCache
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
public Cache<CacheKey, FeatureSet> featureSetCache() {
return featureSetCache;
}
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:4,代码来源:Caches.java
示例12: modelCache
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
public Cache<CacheKey, CompiledLtrModel> modelCache() {
return modelCache;
}
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:4,代码来源:Caches.java
示例13: innerGet
import org.elasticsearch.common.cache.Cache; //导入依赖的package包/类
private <T> T innerGet(String id, Cache<Caches.CacheKey, T> cache) {
return cache.get(key(id));
}
开发者ID:o19s,项目名称:elasticsearch-learning-to-rank,代码行数:4,代码来源:CachedFeatureStore.java
注:本文中的org.elasticsearch.common.cache.Cache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论