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.cache;
16  
17  import com.liferay.portal.kernel.cache.PortalCache;
18  import com.liferay.portal.kernel.cache.PortalCacheManager;
19  import com.liferay.portal.kernel.cache.SingleVMPool;
20  
21  import java.io.Serializable;
22  
23  /**
24   * <a href="SingleVMPoolImpl.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   * @author Michael Young
28   */
29  public class SingleVMPoolImpl implements SingleVMPool {
30  
31      public void clear() {
32          _portalCacheManager.clearAll();
33      }
34  
35      public void clear(String name) {
36          PortalCache portalCache = getCache(name);
37  
38          portalCache.removeAll();
39      }
40  
41      public Object get(String name, String key) {
42          PortalCache portalCache = getCache(name);
43  
44          return portalCache.get(key);
45      }
46  
47      /**
48       * @deprecated
49       */
50      public Object get(PortalCache portalCache, String key) {
51          return portalCache.get(key);
52      }
53  
54      public PortalCache getCache(String name) {
55          return _portalCacheManager.getCache(name);
56      }
57  
58      public PortalCache getCache(String name, boolean blocking) {
59          return _portalCacheManager.getCache(name, blocking);
60      }
61  
62      public void put(String name, String key, Object obj) {
63          PortalCache portalCache = getCache(name);
64  
65          portalCache.put(key, obj);
66      }
67  
68      /**
69       * @deprecated
70       */
71      public void put(PortalCache portalCache, String key, Object obj) {
72          portalCache.put(key, obj);
73      }
74  
75      /**
76       * @deprecated
77       */
78      public void put(
79          PortalCache portalCache, String key, Object obj, int timeToLive) {
80  
81          portalCache.put(key, obj, timeToLive);
82      }
83  
84      public void put(String name, String key, Serializable obj) {
85          PortalCache portalCache = getCache(name);
86  
87          portalCache.put(key, obj);
88      }
89  
90      /**
91       * @deprecated
92       */
93      public void put(PortalCache portalCache, String key, Serializable obj) {
94          portalCache.put(key, obj);
95      }
96  
97      /**
98       * @deprecated
99       */
100     public void put(
101         PortalCache portalCache, String key, Serializable obj, int timeToLive) {
102 
103         portalCache.put(key, obj, timeToLive);
104     }
105 
106     public void remove(String name, String key) {
107         PortalCache portalCache = getCache(name);
108 
109         portalCache.remove(key);
110     }
111 
112     /**
113      * @deprecated
114      */
115     public void remove(PortalCache portalCache, String key) {
116         portalCache.remove(key);
117     }
118 
119     public void removeCache(String name) {
120         _portalCacheManager.removeCache(name);
121     }
122 
123     public void setPortalCacheManager(PortalCacheManager portalCacheManager) {
124         _portalCacheManager = portalCacheManager;
125     }
126 
127     private PortalCacheManager _portalCacheManager;
128 
129 }