当前位置: 首页>>代码示例>>Java>>正文


Java UtilCache.put方法代码示例

本文整理汇总了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);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:EntityCache.java

示例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());
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:18,代码来源:UtilCacheTests.java

示例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;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:11,代码来源:AbstractEntityConditionCache.java

示例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);
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:16,代码来源:EntityCache.java

示例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);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:5,代码来源:ScreenCache.java


注:本文中的org.ofbiz.base.util.cache.UtilCache.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。