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 Brian Wing Shun Chan
023     * @author Michael Young
024     */
025    public class MultiVMPoolUtil {
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            /**
036             * @deprecated
037             */
038            public static Object get(PortalCache portalCache, String key) {
039                    return getMultiVMPool().get(portalCache, key);
040            }
041    
042            public static Object get(String name, String key) {
043                    return getMultiVMPool().get(name, key);
044            }
045    
046            public static PortalCache getCache(String name) {
047                    return getMultiVMPool().getCache(name);
048            }
049    
050            public static PortalCache getCache(String name, boolean blocking) {
051                    return getMultiVMPool().getCache(name, blocking);
052            }
053    
054            public static MultiVMPool getMultiVMPool() {
055                    PortalRuntimePermission.checkGetBeanProperty(MultiVMPoolUtil.class);
056    
057                    return _multiVMPool;
058            }
059    
060            /**
061             * @deprecated
062             */
063            public static void put(PortalCache portalCache, String key, Object value) {
064                    getMultiVMPool().put(portalCache, key, value);
065            }
066    
067            /**
068             * @deprecated
069             */
070            public static void put(
071                    PortalCache portalCache, String key, Serializable value) {
072    
073                    getMultiVMPool().put(portalCache, key, value);
074            }
075    
076            public static void put(String name, String key, Object value) {
077                    getMultiVMPool().put(name, key, value);
078            }
079    
080            public static void put(String name, String key, Serializable value) {
081                    getMultiVMPool().put(name, key, value);
082            }
083    
084            /**
085             * @deprecated
086             */
087            public static void remove(PortalCache portalCache, String key) {
088                    getMultiVMPool().remove(portalCache, key);
089            }
090    
091            public static void remove(String name, String key) {
092                    getMultiVMPool().remove(name, key);
093            }
094    
095            public static void removeCache(String name) {
096                    getMultiVMPool().removeCache(name);
097            }
098    
099            public void setMultiVMPool(MultiVMPool multiVMPool) {
100                    PortalRuntimePermission.checkSetBeanProperty(getClass());
101    
102                    _multiVMPool = multiVMPool;
103            }
104    
105            private static MultiVMPool _multiVMPool;
106    
107    }