001
014
015 package com.liferay.portal.kernel.dao.orm;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019
020
023 public class FinderCacheUtil {
024
025 public static void clearCache() {
026 getFinderCache().clearCache();
027 }
028
029 public static void clearCache(String className) {
030 getFinderCache().clearCache(className);
031 }
032
033 public static void clearLocalCache() {
034 getFinderCache().clearLocalCache();
035 }
036
037 public static FinderCache getFinderCache() {
038 return _finderCache;
039 }
040
041
044 public static Object getResult(
045 String className, String methodName, String[] params, Object[] args,
046 SessionFactory sessionFactory) {
047
048 _log.error(
049 "Regenerate " + className +
050 " via \"ant build-service\" or else caching will not work");
051
052 return null;
053 }
054
055 public static Object getResult(
056 FinderPath finderPath, Object[] args, SessionFactory sessionFactory) {
057
058 return getFinderCache().getResult(finderPath, args, sessionFactory);
059 }
060
061 public static void invalidate() {
062 getFinderCache().invalidate();
063 }
064
065
068 public static void putResult(
069 boolean classNameCacheEnabled, String className, String methodName,
070 String[] params, Object[] args, Object result) {
071
072 _log.error(
073 "Regenerate " + className +
074 " via \"ant build-service\" or else caching will not work");
075 }
076
077 public static void putResult(
078 FinderPath finderPath, Object[] args, Object result) {
079
080 getFinderCache().putResult(finderPath, args, result);
081 }
082
083 public static void removeCache(String className) {
084 getFinderCache().removeCache(className);
085 }
086
087 public static void removeResult(FinderPath finderPath, Object[] args) {
088 getFinderCache().removeResult(finderPath, args);
089 }
090
091 public void setFinderCache(FinderCache finderCache) {
092 _finderCache = finderCache;
093 }
094
095 private static Log _log = LogFactoryUtil.getLog(FinderCacheUtil.class);
096
097 private static FinderCache _finderCache;
098
099 }