001
014
015 package com.liferay.portal.kernel.dao.orm;
016
017 import com.liferay.portal.kernel.cache.PortalCache;
018 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019 import com.liferay.portal.kernel.util.ProxyFactory;
020
021 import java.io.Serializable;
022
023
026 public class EntityCacheUtil {
027
028 public static void clearCache() {
029 _entityCache.clearCache();
030 }
031
032 public static void clearCache(Class<?> clazz) {
033 _entityCache.clearCache(clazz);
034 }
035
036 public static void clearLocalCache() {
037 _entityCache.clearLocalCache();
038 }
039
040 public static EntityCache getEntityCache() {
041 PortalRuntimePermission.checkGetBeanProperty(EntityCacheUtil.class);
042
043 return _entityCache;
044 }
045
046 public static PortalCache<Serializable, Serializable> getPortalCache(
047 Class<?> clazz) {
048
049 return _entityCache.getPortalCache(clazz);
050 }
051
052 public static Serializable getResult(
053 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey) {
054
055 return _entityCache.getResult(entityCacheEnabled, clazz, primaryKey);
056 }
057
058 public static void invalidate() {
059 _entityCache.invalidate();
060 }
061
062 public static Serializable loadResult(
063 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey,
064 SessionFactory sessionFactory) {
065
066 return _entityCache.loadResult(
067 entityCacheEnabled, clazz, primaryKey, sessionFactory);
068 }
069
070 public static void putResult(
071 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey,
072 Serializable result) {
073
074 _entityCache.putResult(entityCacheEnabled, clazz, primaryKey, result);
075 }
076
077 public static void putResult(
078 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey,
079 Serializable result, boolean quiet) {
080
081 _entityCache.putResult(
082 entityCacheEnabled, clazz, primaryKey, result, quiet);
083 }
084
085 public static void removeCache(String className) {
086 _entityCache.removeCache(className);
087 }
088
089 public static void removeResult(
090 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey) {
091
092 _entityCache.removeResult(entityCacheEnabled, clazz, primaryKey);
093 }
094
095 private static final EntityCache _entityCache =
096 ProxyFactory.newServiceTrackedInstance(EntityCache.class);
097
098 }