001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.cache;
022:
023: import com.liferay.portal.kernel.cache.PortalCache;
024: import com.liferay.portal.kernel.cache.PortalCacheManager;
025: import com.liferay.portal.kernel.cache.SingleVMPool;
026:
027: import java.io.Serializable;
028:
029: /**
030: * <a href="SingleVMPoolImpl.java.html"><b><i>View Source</i></b></a>
031: *
032: * @author Brian Wing Shun Chan
033: * @author Michael Young
034: *
035: */
036: public class SingleVMPoolImpl implements SingleVMPool {
037:
038: public void clear() {
039: _portalCacheManager.clearAll();
040: }
041:
042: public void clear(String name) {
043: PortalCache portalCache = getCache(name);
044:
045: portalCache.removeAll();
046: }
047:
048: public Object get(String name, String key) {
049: PortalCache portalCache = getCache(name);
050:
051: return get(portalCache, key);
052: }
053:
054: public Object get(PortalCache portalCache, String key) {
055: return portalCache.get(key);
056: }
057:
058: public PortalCache getCache(String name) {
059: return _portalCacheManager.getCache(name);
060: }
061:
062: public void put(String name, String key, Object obj) {
063: PortalCache portalCache = getCache(name);
064:
065: put(portalCache, key, obj);
066: }
067:
068: public void put(PortalCache portalCache, String key, Object obj) {
069: portalCache.put(key, obj);
070: }
071:
072: public void put(String name, String key, Serializable obj) {
073: PortalCache portalCache = getCache(name);
074:
075: put(portalCache, key, obj);
076: }
077:
078: public void put(PortalCache portalCache, String key,
079: Serializable obj) {
080: portalCache.put(key, obj);
081: }
082:
083: public void remove(String name, String key) {
084: PortalCache portalCache = getCache(name);
085:
086: remove(portalCache, key);
087: }
088:
089: public void remove(PortalCache portalCache, String key) {
090: portalCache.remove(key);
091: }
092:
093: public void setPortalCacheManager(
094: PortalCacheManager portalCacheManager) {
095: _portalCacheManager = portalCacheManager;
096: }
097:
098: private PortalCacheManager _portalCacheManager;
099:
100: }
|