001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.cache;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    
019    import java.io.Serializable;
020    
021    /**
022     * @author Edward Han
023     * @author Brian Wing Shun Chan
024     */
025    public class MultiVMKeyPoolUtil {
026    
027            public static void clear() {
028                    getMultiVMPool().clear();
029            }
030    
031            public static void clear(String name) {
032                    getMultiVMPool().clear(name);
033            }
034    
035            public static Object get(String name, String key) {
036                    return getMultiVMPool().get(name, key);
037            }
038    
039            public static PortalCache getCache(String name) {
040                    return getMultiVMPool().getCache(name);
041            }
042    
043            public static PortalCache getCache(String name, boolean blocking) {
044                    return getMultiVMPool().getCache(name, blocking);
045            }
046    
047            public static MultiVMPool getMultiVMPool() {
048                    PortalRuntimePermission.checkGetBeanProperty(MultiVMKeyPoolUtil.class);
049    
050                    return _multiVMPool;
051            }
052    
053            public static void put(String name, String key, Object value) {
054                    getMultiVMPool().put(name, key, value);
055            }
056    
057            public static void put(String name, String key, Serializable value) {
058                    getMultiVMPool().put(name, key, value);
059            }
060    
061            public static void remove(String name, String key) {
062                    getMultiVMPool().remove(name, key);
063            }
064    
065            public static void removeCache(String name) {
066                    getMultiVMPool().removeCache(name);
067            }
068    
069            public void setMultiVMPool(MultiVMPool multiVMPool) {
070                    PortalRuntimePermission.checkSetBeanProperty(getClass());
071    
072                    _multiVMPool = multiVMPool;
073            }
074    
075            private static MultiVMPool _multiVMPool;
076    
077    }