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