1 package com.trendmicro.grid.acl.ds.cache;
2
3 import java.util.Collection;
4 import java.util.List;
5
6 /**
7 * Defines the interface to communicate with a cache source (used to read elements from a cache).
8 *
9 * @author juergen_kellerer, 2011-03-25
10 * @version 1.0
11 */
12 public interface CacheSource<K, V> {
13 /**
14 * Gets the values of the specified keys.
15 *
16 * @param keys the keys to get.
17 * @return a collection of cached values. The collection may contain 'null'
18 * values for non-existing keys and keys that map to 'null'
19 */
20 List<V> getAll(Collection<K> keys);
21
22 /**
23 * Returns true if the given key is contained.
24 *
25 * @param key the key to check.
26 * @return true if the given key is contained.
27 */
28 boolean containsKey(K key);
29
30 /**
31 * Returns the size of the cache.
32 *
33 * @return the size of the cache.
34 */
35 int size();
36
37 /**
38 * Returns true if the cache is empty.
39 *
40 * @return true if the cache is empty.
41 */
42 boolean isEmpty();
43 }