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 SingleVMPoolUtil {
026    
027            public static void clear() {
028                    getSingleVMPool().clear();
029            }
030    
031            public static void clear(String name) {
032                    getSingleVMPool().clear(name);
033            }
034    
035            /**
036             * @deprecated
037             */
038            public static Object get(PortalCache portalCache, String key) {
039                    return getSingleVMPool().get(portalCache, key);
040            }
041    
042            public static Object get(String name, String key) {
043                    return getSingleVMPool().get(name, key);
044            }
045    
046            public static PortalCache getCache(String name) {
047                    return getSingleVMPool().getCache(name);
048            }
049    
050            public static PortalCache getCache(String name, boolean blocking) {
051                    return getSingleVMPool().getCache(name, blocking);
052            }
053    
054            public static SingleVMPool getSingleVMPool() {
055                    PortalRuntimePermission.checkGetBeanProperty(SingleVMPoolUtil.class);
056    
057                    return _singleVMPool;
058            }
059    
060            /**
061             * @deprecated
062             */
063            public static void put(PortalCache portalCache, String key, Object value) {
064                    getSingleVMPool().put(portalCache, key, value);
065            }
066    
067            /**
068             * @deprecated
069             */
070            public static void put(
071                    PortalCache portalCache, String key, Object value, int timeToLive) {
072    
073                    getSingleVMPool().put(portalCache, key, value, timeToLive);
074            }
075    
076            /**
077             * @deprecated
078             */
079            public static void put(
080                    PortalCache portalCache, String key, Serializable value) {
081    
082                    getSingleVMPool().put(portalCache, key, value);
083            }
084    
085            /**
086             * @deprecated
087             */
088            public static void put(
089                    PortalCache portalCache, String key, Serializable value,
090                    int timeToLive) {
091    
092                    getSingleVMPool().put(portalCache, key, value, timeToLive);
093            }
094    
095            public static void put(String name, String key, Object value) {
096                    getSingleVMPool().put(name, key, value);
097            }
098    
099            public static void put(String name, String key, Serializable value) {
100                    getSingleVMPool().put(name, key, value);
101            }
102    
103            /**
104             * @deprecated
105             */
106            public static void remove(PortalCache portalCache, String key) {
107                    getSingleVMPool().remove(portalCache, key);
108            }
109    
110            public static void remove(String name, String key) {
111                    getSingleVMPool().remove(name, key);
112            }
113    
114            public static void removeCache(String name) {
115                    getSingleVMPool().removeCache(name);
116            }
117    
118            public void setSingleVMPool(SingleVMPool singleVMPool) {
119                    PortalRuntimePermission.checkSetBeanProperty(getClass());
120    
121                    _singleVMPool = singleVMPool;
122            }
123    
124            private static SingleVMPool _singleVMPool;
125    
126    }