1
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
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
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
71 public void put(PortalCache portalCache, String key, Object obj) {
72 portalCache.put(key, obj);
73 }
74
75
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
93 public void put(PortalCache portalCache, String key, Serializable obj) {
94 portalCache.put(key, obj);
95 }
96
97
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
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 }