com.baidu.unbiz.fluentvalidator.support
类 ConcurrentCache<K,V>
java.lang.Object
com.baidu.unbiz.fluentvalidator.support.ConcurrentCache<K,V>
- 所有已实现的接口:
- Computable<K,V>
public class ConcurrentCache<K,V>
- extends Object
- implements Computable<K,V>
此类不用额外使用自旋锁或者同步器,可保证并发时线程安全,在并发情况下具有高性能
| 从类 java.lang.Object 继承的方法 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
concurrentMap
protected final ConcurrentMap<K,Future<V>> concurrentMap
ConcurrentCache
public ConcurrentCache()
createComputable
public static <K,V> Computable<K,V> createComputable()
get
public V get(K key,
Callable<V> callable)
- 通过关键字获取数据,如果存在则直接返回,如果不存在,则通过计算
callable来生成
- 指定者:
- 接口
Computable<K,V> 中的 get
- 参数:
key - 查找关键字callable - # @see Callable
- 返回:
- 计算结果
Copyright © 2015–2016 neoremind. All rights reserved.