001    /**
002     * Copyright (c) 2000-present 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.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 PortalCacheManager<? extends Serializable, ? extends Serializable>
052                    getCacheManager() {
053    
054                    return _portalCacheManager;
055            }
056    
057            @Override
058            public void removeCache(String name) {
059                    _portalCacheManager.removeCache(name);
060            }
061    
062            public void setPortalCacheManager(
063                    PortalCacheManager<? extends Serializable, ? extends Serializable>
064                            portalCacheManager) {
065    
066                    _portalCacheManager = portalCacheManager;
067            }
068    
069            private PortalCacheManager<? extends Serializable, ? extends Serializable>
070                    _portalCacheManager;
071    
072    }