本文整理了Java中com.google.common.cache.LocalCache.hash()
方法的一些代码示例,展示了LocalCache.hash()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalCache.hash()
方法的具体详情如下:
包路径:com.google.common.cache.LocalCache
类名称:LocalCache
方法名:hash
暂无
代码示例来源:origin: google/guava
@Override
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> function) {
checkNotNull(key);
checkNotNull(function);
int hash = hash(key);
return segmentFor(hash).compute(key, hash, function);
}
代码示例来源:origin: google/guava
@Override
public V put(K key, V value) {
checkNotNull(key);
checkNotNull(value);
int hash = hash(key);
return segmentFor(hash).put(key, hash, value, false);
}
代码示例来源:origin: google/guava
@Override
public V replace(K key, V value) {
checkNotNull(key);
checkNotNull(value);
int hash = hash(key);
return segmentFor(hash).replace(key, hash, value);
}
代码示例来源:origin: google/guava
@Override
public V putIfAbsent(K key, V value) {
checkNotNull(key);
checkNotNull(value);
int hash = hash(key);
return segmentFor(hash).put(key, hash, value, true);
}
代码示例来源:origin: google/guava
void refresh(K key) {
int hash = hash(checkNotNull(key));
segmentFor(hash).refresh(key, hash, defaultLoader, false);
}
代码示例来源:origin: google/guava
V get(K key, CacheLoader<? super K, V> loader) throws ExecutionException {
int hash = hash(checkNotNull(key));
return segmentFor(hash).get(key, hash, loader);
}
代码示例来源:origin: google/guava
@Override
public boolean replace(K key, @Nullable V oldValue, V newValue) {
checkNotNull(key);
checkNotNull(newValue);
if (oldValue == null) {
return false;
}
int hash = hash(key);
return segmentFor(hash).replace(key, hash, oldValue, newValue);
}
代码示例来源:origin: google/guava
@Override
public boolean containsKey(@Nullable Object key) {
// does not impact recency ordering
if (key == null) {
return false;
}
int hash = hash(key);
return segmentFor(hash).containsKey(key, hash);
}
代码示例来源:origin: google/guava
/**
* Returns the internal entry for the specified key. The entry may be loading, expired, or
* partially collected.
*/
ReferenceEntry<K, V> getEntry(@Nullable Object key) {
// does not impact recency ordering
if (key == null) {
return null;
}
int hash = hash(key);
return segmentFor(hash).getEntry(key, hash);
}
代码示例来源:origin: google/guava
@Override
public V remove(@Nullable Object key) {
if (key == null) {
return null;
}
int hash = hash(key);
return segmentFor(hash).remove(key, hash);
}
代码示例来源:origin: wildfly/wildfly
@Override
public V put(K key, V value) {
checkNotNull(key);
checkNotNull(value);
int hash = hash(key);
return segmentFor(hash).put(key, hash, value, false);
}
代码示例来源:origin: google/guava
@Override
public boolean remove(@Nullable Object key, @Nullable Object value) {
if (key == null || value == null) {
return false;
}
int hash = hash(key);
return segmentFor(hash).remove(key, hash, value);
}
代码示例来源:origin: wildfly/wildfly
@Override
public V putIfAbsent(K key, V value) {
checkNotNull(key);
checkNotNull(value);
int hash = hash(key);
return segmentFor(hash).put(key, hash, value, true);
}
代码示例来源:origin: wildfly/wildfly
@Override
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> function) {
checkNotNull(key);
checkNotNull(function);
int hash = hash(key);
return segmentFor(hash).compute(key, hash, function);
}
代码示例来源:origin: wildfly/wildfly
@Override
public V replace(K key, V value) {
checkNotNull(key);
checkNotNull(value);
int hash = hash(key);
return segmentFor(hash).replace(key, hash, value);
}
代码示例来源:origin: google/guava
@Override
public @Nullable V get(@Nullable Object key) {
if (key == null) {
return null;
}
int hash = hash(key);
return segmentFor(hash).get(key, hash);
}
代码示例来源:origin: wildfly/wildfly
void refresh(K key) {
int hash = hash(checkNotNull(key));
segmentFor(hash).refresh(key, hash, defaultLoader, false);
}
代码示例来源:origin: wildfly/wildfly
V get(K key, CacheLoader<? super K, V> loader) throws ExecutionException {
int hash = hash(checkNotNull(key));
return segmentFor(hash).get(key, hash, loader);
}
代码示例来源:origin: google/guava
public @Nullable V getIfPresent(Object key) {
int hash = hash(checkNotNull(key));
V value = segmentFor(hash).get(key, hash);
if (value == null) {
globalStatsCounter.recordMisses(1);
} else {
globalStatsCounter.recordHits(1);
}
return value;
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean replace(K key, @NullableDecl V oldValue, V newValue) {
checkNotNull(key);
checkNotNull(newValue);
if (oldValue == null) {
return false;
}
int hash = hash(key);
return segmentFor(hash).replace(key, hash, oldValue, newValue);
}
内容来源于网络,如有侵权,请联系作者删除!