001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }