public void putResult( boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey, Object result) { if (!PropsValues.VALUE_OBJECT_ENTITY_CACHE_ENABLED || !entityCacheEnabled || !CacheRegistryUtil.isActive() || (result == null)) { return; } result = ((BaseModel<?>) result).toCacheModel(); if (_localCacheAvailable) { Map<Serializable, Object> localCache = _localCache.get(); Serializable localCacheKey = _encodeLocalCacheKey(clazz, primaryKey); localCache.put(localCacheKey, result); } PortalCache portalCache = _getPortalCache(clazz.getName(), true); Serializable cacheKey = _encodeCacheKey(primaryKey); portalCache.put(cacheKey, result); }
@Override public void putResult( boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey, Serializable result, boolean quiet) { if (!PropsValues.VALUE_OBJECT_ENTITY_CACHE_ENABLED || !entityCacheEnabled || !CacheRegistryUtil.isActive() || (result == null)) { return; } result = ((BaseModel<?>) result).toCacheModel(); if (_LOCAL_CACHE_AVAILABLE) { Map<Serializable, Serializable> localCache = _localCache.get(); Serializable localCacheKey = _encodeLocalCacheKey(clazz, primaryKey); localCache.put(localCacheKey, result); } PortalCache<Serializable, Serializable> portalCache = _getPortalCache(clazz, true); Serializable cacheKey = _encodeCacheKey(primaryKey); if (quiet) { PortalCacheHelperUtil.putWithoutReplicator(portalCache, cacheKey, result); } else { portalCache.put(cacheKey, result); } }
public void put(String name, String key, Serializable value) { PortalCache portalCache = getCache(name); portalCache.put(key, value); }
public void put(String name, String key, Object value) { PortalCache portalCache = getCache(name); portalCache.put(key, value); }
/** @deprecated */ public void put(PortalCache portalCache, String key, Serializable value, int timeToLive) { portalCache.put(key, value, timeToLive); }
/** @deprecated */ public void put(PortalCache portalCache, String key, Serializable value) { portalCache.put(key, value); }
/** @deprecated */ public void put(PortalCache portalCache, String key, Object value, int timeToLive) { portalCache.put(key, value, timeToLive); }
/** @deprecated */ public void put(PortalCache portalCache, String key, Object value) { portalCache.put(key, value); }
public Object loadResult( boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey, SessionFactory sessionFactory) { if (!PropsValues.VALUE_OBJECT_ENTITY_CACHE_ENABLED || !entityCacheEnabled || !CacheRegistryUtil.isActive()) { Session session = null; try { session = sessionFactory.openSession(); return session.load(clazz, primaryKey); } finally { sessionFactory.closeSession(session); } } Object result = null; Map<Serializable, Object> localCache = null; Serializable localCacheKey = null; if (_localCacheAvailable) { localCache = _localCache.get(); localCacheKey = _encodeLocalCacheKey(clazz, primaryKey); result = localCache.get(localCacheKey); } Object loadResult = null; if (result == null) { PortalCache portalCache = _getPortalCache(clazz.getName(), true); Serializable cacheKey = _encodeCacheKey(primaryKey); result = portalCache.get(cacheKey); if (result == null) { if (_log.isDebugEnabled()) { _log.debug("Load " + clazz + " " + primaryKey + " from session"); } Session session = null; try { session = sessionFactory.openSession(); loadResult = session.load(clazz, primaryKey); } finally { if (loadResult == null) { result = StringPool.BLANK; } else { result = ((BaseModel<?>) loadResult).toCacheModel(); } portalCache.put(cacheKey, result); sessionFactory.closeSession(session); } } if (_localCacheAvailable) { localCache.put(localCacheKey, result); } } if (loadResult != null) { return loadResult; } else { return _toEntityModel(result); } }