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 java.io.Serializable;
018    
019    import java.util.Collection;
020    import java.util.List;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     * @author Edward Han
025     * @author Shuyang Zhou
026     */
027    public interface PortalCache<K extends Serializable, V> {
028    
029            public void destroy();
030    
031            public Collection<V> get(Collection<K> keys);
032    
033            public V get(K key);
034    
035            public List<K> getKeys();
036    
037            public String getName();
038    
039            public void put(K key, V value);
040    
041            public void put(K key, V value, int timeToLive);
042    
043            public void registerCacheListener(CacheListener<K, V> cacheListener);
044    
045            public void registerCacheListener(
046                    CacheListener<K, V> cacheListener,
047                    CacheListenerScope cacheListenerScope);
048    
049            public void remove(K key);
050    
051            public void removeAll();
052    
053            public void unregisterCacheListener(CacheListener<K, V> cacheListener);
054    
055            public void unregisterCacheListeners();
056    
057    }