1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.kernel.dao.orm;
16  
17  import java.io.Serializable;
18  
19  /**
20   * <a href="EntityCacheUtil.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Brian Wing Shun Chan
23   */
24  public class EntityCacheUtil {
25  
26      public static void clearCache() {
27          getEntityCache().clearCache();
28      }
29  
30      public static void clearCache(String className) {
31          getEntityCache().clearCache(className);
32      }
33  
34      public static void clearLocalCache() {
35          getEntityCache().clearLocalCache();
36      }
37  
38      public static EntityCache getEntityCache() {
39          return _finderCache;
40      }
41  
42      public static Object getResult(
43          boolean entityCacheEnabled, Class<?> classObj,
44          Serializable primaryKeyObj, SessionFactory sessionFactory) {
45  
46          return getEntityCache().getResult(
47              entityCacheEnabled, classObj, primaryKeyObj, sessionFactory);
48      }
49  
50      public static void invalidate() {
51          getEntityCache().invalidate();
52      }
53  
54      public static Object loadResult(
55          boolean entityCacheEnabled, Class<?> classObj,
56          Serializable primaryKeyObj, SessionFactory sessionFactory) {
57  
58          return getEntityCache().loadResult(
59              entityCacheEnabled, classObj, primaryKeyObj, sessionFactory);
60      }
61  
62      public static void putResult(
63          boolean entityCacheEnabled, Class<?> classObj,
64          Serializable primaryKeyObj, Object result) {
65  
66          getEntityCache().putResult(
67              entityCacheEnabled, classObj, primaryKeyObj, result);
68      }
69  
70      public static void removeCache(String className) {
71          getEntityCache().removeCache(className);
72      }
73  
74      public static void removeResult(
75          boolean entityCacheEnabled, Class<?> classObj,
76          Serializable primaryKeyObj) {
77  
78          getEntityCache().removeResult(
79              entityCacheEnabled, classObj, primaryKeyObj);
80      }
81  
82      public void setEntityCache(EntityCache finderCache) {
83          _finderCache = finderCache;
84      }
85  
86      private static EntityCache _finderCache;
87  
88  }