001    /**
002     * Copyright (c) 2000-2013 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.cache;
016    
017    import com.liferay.portal.kernel.cache.MultiVMPool;
018    import com.liferay.portal.kernel.cache.PortalCache;
019    import com.liferay.portal.kernel.cache.PortalCacheManager;
020    import com.liferay.portal.kernel.security.pacl.DoPrivileged;
021    
022    import java.io.Serializable;
023    
024    /**
025     * @author Brian Wing Shun Chan
026     * @author Michael Young
027     */
028    @DoPrivileged
029    public class MultiVMPoolImpl implements MultiVMPool {
030    
031            @Override
032            public void clear() {
033                    _portalCacheManager.clearAll();
034            }
035    
036            @Override
037            public PortalCache<? extends Serializable, ? extends Serializable> getCache(
038                    String name) {
039    
040                    return _portalCacheManager.getCache(name);
041            }
042    
043            @Override
044            public PortalCache<? extends Serializable, ? extends Serializable> getCache(
045                    String name, boolean blocking) {
046    
047                    return _portalCacheManager.getCache(name, blocking);
048            }
049    
050            @Override
051            public void removeCache(String name) {
052                    _portalCacheManager.removeCache(name);
053            }
054    
055            public void setPortalCacheManager(
056                    PortalCacheManager<? extends Serializable, ? extends Serializable>
057                            portalCacheManager) {
058    
059                    _portalCacheManager = portalCacheManager;
060            }
061    
062            private PortalCacheManager<? extends Serializable, ? extends Serializable>
063                    _portalCacheManager;
064    
065    }