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.PortalCache;
018    import com.liferay.portal.kernel.cache.PortalCacheManager;
019    import com.liferay.portal.kernel.cache.SingleVMPool;
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 SingleVMPoolImpl implements SingleVMPool {
030    
031            @Override
032            public void clear() {
033                    _portalCacheManager.clearAll();
034            }
035    
036            @Override
037            public PortalCache<? extends Serializable, ?> getCache(String name) {
038                    return _portalCacheManager.getCache(name);
039            }
040    
041            @Override
042            public PortalCache<? extends Serializable, ?> getCache(
043                    String name, boolean blocking) {
044    
045                    return _portalCacheManager.getCache(name, blocking);
046            }
047    
048            @Override
049            public void removeCache(String name) {
050                    _portalCacheManager.removeCache(name);
051            }
052    
053            public void setPortalCacheManager(
054                    PortalCacheManager<? extends Serializable, ?> portalCacheManager) {
055    
056                    _portalCacheManager = portalCacheManager;
057            }
058    
059            private PortalCacheManager<? extends Serializable, ?> _portalCacheManager;
060    
061    }