1 package com.atlassian.cache;
2
3 import javax.annotation.Nonnull;
4
5 import com.atlassian.annotations.PublicApi;
6
7 /**
8 * A cache listener.
9 *
10 * @since 2.4
11 */
12 @PublicApi
13 public interface CacheEntryListener<K, V>
14 {
15 /**
16 * Invoked when a key-value was added to the cache
17 *
18 * @param event the addition event
19 */
20 void onAdd(@Nonnull CacheEntryEvent<K, V> event);
21
22 /**
23 * Invoked when a key-value was evicted from the cache
24 *
25 * @param event the eviction event
26 */
27 void onEvict(@Nonnull CacheEntryEvent<K, V> event);
28
29 /**
30 * Invoked when a key-value was removed from the cache
31 *
32 * @param event the removal event
33 */
34 void onRemove(@Nonnull CacheEntryEvent<K, V> event);
35
36 /**
37 * Invoked when key-value was changed in the cache
38 *
39 * @param event the update event
40 */
41 void onUpdate(@Nonnull CacheEntryEvent<K, V> event);
42 }