| 1 | |
package org.webslinger.lang; |
| 2 | |
|
| 3 | |
public abstract class ConcurrentFreezableCache<K, V> extends AbstractConcurrentCache<K, V>{ |
| 4 | 1 | public static final ValueType HARD = ValueType.HARD; |
| 5 | 1 | public static final ValueType SOFT = ValueType.SOFT; |
| 6 | 1 | public static final ValueType WEAK = ValueType.WEAK; |
| 7 | |
|
| 8 | |
public ConcurrentFreezableCache(Class<?> owner, String field, String label) { |
| 9 | 0 | this(owner, field, label, null, false); |
| 10 | 0 | } |
| 11 | |
|
| 12 | |
public ConcurrentFreezableCache(Class<?> owner, String field, String label, boolean sorted) { |
| 13 | 0 | this(owner, field, label, null, sorted); |
| 14 | 0 | } |
| 15 | |
|
| 16 | |
public ConcurrentFreezableCache(Class<?> owner, String field, String label, AbstractConcurrentCache.ValueType valueType) { |
| 17 | 895 | super(owner, field, label, valueType, false); |
| 18 | 895 | } |
| 19 | |
|
| 20 | |
public ConcurrentFreezableCache(Class<?> owner, String field, String label, AbstractConcurrentCache.ValueType valueType, boolean sorted) { |
| 21 | 0 | super(owner, field, label, valueType, sorted); |
| 22 | 0 | } |
| 23 | |
|
| 24 | |
public V get(Freezable<K> id) throws Exception { |
| 25 | 0 | return get(id, id.freeze()); |
| 26 | |
} |
| 27 | |
|
| 28 | |
public V get(Freezable<K> id, boolean create) throws Exception { |
| 29 | 0 | return get(id, id.freeze(), create); |
| 30 | |
} |
| 31 | |
|
| 32 | |
protected abstract V createValue(Object id, K key) throws Exception; |
| 33 | |
} |