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
020 import java.io.Serializable;
021
022
025 public class EntityCacheUtil {
026
027 public static void clearCache() {
028 getEntityCache().clearCache();
029 }
030
031 public static void clearCache(Class<?> clazz) {
032 getEntityCache().clearCache(clazz);
033 }
034
035 public static void clearLocalCache() {
036 getEntityCache().clearLocalCache();
037 }
038
039 public static EntityCache getEntityCache() {
040 PortalRuntimePermission.checkGetBeanProperty(EntityCacheUtil.class);
041
042 return _entityCache;
043 }
044
045 public static PortalCache<Serializable, Serializable> getPortalCache(
046 Class<?> clazz) {
047
048 return getEntityCache().getPortalCache(clazz);
049 }
050
051 public static Serializable getResult(
052 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey) {
053
054 return getEntityCache().getResult(
055 entityCacheEnabled, clazz, primaryKey);
056 }
057
058 public static void invalidate() {
059 getEntityCache().invalidate();
060 }
061
062 public static Serializable loadResult(
063 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey,
064 SessionFactory sessionFactory) {
065
066 return getEntityCache().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 getEntityCache().putResult(
075 entityCacheEnabled, clazz, primaryKey, result);
076 }
077
078 public static void putResult(
079 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey,
080 Serializable result, boolean quiet) {
081
082 getEntityCache().putResult(
083 entityCacheEnabled, clazz, primaryKey, result, quiet);
084 }
085
086 public static void removeCache(String className) {
087 getEntityCache().removeCache(className);
088 }
089
090 public static void removeResult(
091 boolean entityCacheEnabled, Class<?> clazz, Serializable primaryKey) {
092
093 getEntityCache().removeResult(entityCacheEnabled, clazz, primaryKey);
094 }
095
096 public void setEntityCache(EntityCache entityCache) {
097 PortalRuntimePermission.checkSetBeanProperty(getClass());
098
099 _entityCache = entityCache;
100 }
101
102 private static EntityCache _entityCache;
103
104 }