001    /**
002     * Copyright (c) 2000-2011 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.keypool;
016    
017    import com.liferay.portal.kernel.cache.CacheListener;
018    import com.liferay.portal.kernel.cache.PortalCache;
019    
020    import java.io.Serializable;
021    
022    /**
023     * @author Edward Han
024     * @author Brian Wing Shun Chan
025     */
026    public class MultiVMKeyPoolCacheListener implements CacheListener {
027    
028            public MultiVMKeyPoolCacheListener(PortalCache localPortalCache) {
029                    _localPortalCache = localPortalCache;
030            }
031    
032            public void notifyEntryEvicted(
033                    PortalCache portalCache, Serializable key, Object value) {
034    
035                    _localPortalCache.remove(key);
036            }
037    
038            public void notifyEntryExpired(
039                    PortalCache portalCache, Serializable key, Object value) {
040    
041                    _localPortalCache.remove(key);
042            }
043    
044            public void notifyEntryPut(
045                    PortalCache portalCache, Serializable key, Object value) {
046    
047                    _localPortalCache.put(key, value);
048            }
049    
050            public void notifyEntryRemoved(
051                    PortalCache portalCache, Serializable key, Object value) {
052    
053                    _localPortalCache.remove(key);
054            }
055    
056            public void notifyEntryUpdated(
057                    PortalCache portalCache, Serializable key, Object value) {
058    
059                    _localPortalCache.put(key, value);
060            }
061    
062            public void notifyRemoveAll(PortalCache portalCache) {
063                    _localPortalCache.removeAll();
064            }
065    
066            private PortalCache _localPortalCache;
067    
068    }