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.MultiVMPool;
18  import com.liferay.portal.kernel.cache.PortalCache;
19  import com.liferay.portal.kernel.cache.PortalCacheManager;
20  
21  import java.io.Serializable;
22  
23  /**
24   * <a href="MultiVMPoolImpl.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   * @author Michael Young
28   */
29  public class MultiVMPoolImpl implements MultiVMPool {
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      public void put(String name, String key, Serializable obj) {
76          PortalCache portalCache = getCache(name);
77  
78          portalCache.put(key, obj);
79      }
80  
81      /**
82       * @deprecated
83       */
84      public void put(PortalCache portalCache, String key, Serializable obj) {
85          portalCache.put(key, obj);
86      }
87  
88      public void remove(String name, String key) {
89          PortalCache portalCache = getCache(name);
90  
91          portalCache.remove(key);
92      }
93  
94      /**
95       * @deprecated
96       */
97      public void remove(PortalCache portalCache, String key) {
98          portalCache.remove(key);
99      }
100 
101     public void removeCache(String name) {
102         _portalCacheManager.removeCache(name);
103     }
104 
105     public void setPortalCacheManager(PortalCacheManager portalCacheManager) {
106         _portalCacheManager = portalCacheManager;
107     }
108 
109     private PortalCacheManager _portalCacheManager;
110 
111 }