1
19
20 package com.liferay.portal.cache;
21
22 import com.liferay.portal.kernel.cache.PortalCache;
23 import com.liferay.portal.kernel.cache.PortalCacheManager;
24 import com.liferay.portal.kernel.cache.SingleVMPool;
25
26 import java.io.Serializable;
27
28
35 public class SingleVMPoolImpl implements SingleVMPool {
36
37 public void clear() {
38 _portalCacheManager.clearAll();
39 }
40
41 public void clear(String name) {
42 PortalCache portalCache = getCache(name);
43
44 portalCache.removeAll();
45 }
46
47 public Object get(String name, String key) {
48 PortalCache portalCache = getCache(name);
49
50 return get(portalCache, key);
51 }
52
53 public Object get(PortalCache portalCache, String key) {
54 return portalCache.get(key);
55 }
56
57 public PortalCache getCache(String name) {
58 return _portalCacheManager.getCache(name);
59 }
60
61 public void put(String name, String key, Object obj) {
62 PortalCache portalCache = getCache(name);
63
64 put(portalCache, key, obj);
65 }
66
67 public void put(PortalCache portalCache, String key, Object obj) {
68 portalCache.put(key, obj);
69 }
70
71 public void put(
72 PortalCache portalCache, String key, Object obj, int timeToLive) {
73
74 portalCache.put(key, obj, timeToLive);
75 }
76
77 public void put(String name, String key, Serializable obj) {
78 PortalCache portalCache = getCache(name);
79
80 put(portalCache, key, obj);
81 }
82
83 public void put(PortalCache portalCache, String key, Serializable obj) {
84 portalCache.put(key, obj);
85 }
86
87 public void put(
88 PortalCache portalCache, String key, Serializable obj, int timeToLive) {
89
90 portalCache.put(key, obj, timeToLive);
91 }
92
93 public void remove(String name, String key) {
94 PortalCache portalCache = getCache(name);
95
96 remove(portalCache, key);
97 }
98
99 public void remove(PortalCache portalCache, String key) {
100 portalCache.remove(key);
101 }
102
103 public void setPortalCacheManager(PortalCacheManager portalCacheManager) {
104 _portalCacheManager = portalCacheManager;
105 }
106
107 private PortalCacheManager _portalCacheManager;
108
109 }