本文整理汇总了Java中org.ofbiz.base.util.cache.UtilCache.put方法的典型用法代码示例。如果您正苦于以下问题:Java UtilCache.put方法的具体用法?Java UtilCache.put怎么用?Java UtilCache.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ofbiz.base.util.cache.UtilCache
的用法示例。
在下文中一共展示了UtilCache.put方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: put
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public GenericValue put(GenericPK pk, GenericValue entity) {
if (pk.getModelEntity().getNeverCache()) {
if (Debug.verboseOn()) { // SCIPIO: only log if verbose on (but still log as warning!)
Debug.logWarning("Tried to put a value of the " + pk.getEntityName() + " entity in the BY PRIMARY KEY cache but this entity has never-cache set to true, not caching.", module);
}
return null;
}
if (entity == null) {
entity = GenericValue.NULL_VALUE;
} else {
// before going into the cache, make this value immutable
entity.setImmutable();
}
UtilCache<GenericPK, GenericValue> entityCache = getOrCreateCache(pk.getEntityName());
return entityCache.put(pk, entity);
}
示例2: assertKey
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public static <K, V> void assertKey(String label, UtilCache<K, V> cache, K key, V value, V other, int size, Map<K, V> map) {
assertNull(label + ":get-empty", cache.get(key));
assertFalse(label + ":containsKey-empty", cache.containsKey(key));
V oldValue = cache.put(key, other);
assertTrue(label + ":containsKey-class", cache.containsKey(key));
assertEquals(label + ":get-class", other, cache.get(key));
assertNull(label + ":oldValue-class", oldValue);
assertEquals(label + ":size-class", size, cache.size());
oldValue = cache.put(key, value);
assertTrue(label + ":containsKey-value", cache.containsKey(key));
assertEquals(label + ":get-value", value, cache.get(key));
assertEquals(label + ":oldValue-value", other, oldValue);
assertEquals(label + ":size-value", size, cache.size());
map.put(key, value);
assertEquals(label + ":map-keys", map.keySet(), cache.getCacheLineKeys());
assertEquals(label + ":map-values", map.values(), cache.values());
}
示例3: getOrCreateConditionCache
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
protected Map<K, V> getOrCreateConditionCache(String entityName, EntityCondition condition) {
UtilCache<EntityCondition, ConcurrentMap<K, V>> utilCache = getOrCreateCache(entityName);
EntityCondition conditionKey = getConditionKey(condition);
ConcurrentMap<K, V> conditionCache = utilCache.get(conditionKey);
if (conditionCache == null) {
conditionCache = new ConcurrentHashMap<K, V>();
utilCache.put(conditionKey, conditionCache);
}
return conditionCache;
}
示例4: put
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public GenericValue put(GenericPK pk, GenericValue entity) {
if (pk.getModelEntity().getNeverCache()) {
Debug.logWarning("Tried to put a value of the " + pk.getEntityName() + " entity in the BY PRIMARY KEY cache but this entity has never-cache set to true, not caching.", module);
return null;
}
if (entity == null) {
entity = GenericValue.NULL_VALUE;
} else {
// before going into the cache, make this value immutable
entity.setImmutable();
}
UtilCache<GenericPK, GenericValue> entityCache = getOrCreateCache(pk.getEntityName());
return entityCache.put(pk, entity);
}
示例5: put
import org.ofbiz.base.util.cache.UtilCache; //导入方法依赖的package包/类
public GenericWidgetOutput put(String screenName, WidgetContextCacheKey wcck, GenericWidgetOutput output) {
UtilCache<WidgetContextCacheKey, GenericWidgetOutput> screenCache = getOrCreateCache(screenName);
return screenCache.put(wcck, output);
}