1 package com.atlassian.vcache;
2
3 import java.util.Arrays;
4
5 import com.atlassian.annotations.PublicApi;
6
7 /**
8 * Represents the buffered write operations on an {@link ExternalCache}. The write operations are replayed at the
9 * end of the request.
10 *
11 * @param <V> the value type
12 *
13 * @since 1.0
14 */
15 @PublicApi
16 public interface ExternalWriteOperationsBuffered<V>
17 {
18 /**
19 * Puts the value under the specified key using the specified policy.
20 *
21 * @param key the key to put the data under
22 * @param value the value to associate with the key.
23 * @param policy the policy to apply
24 */
25 void put(String key, V value, PutPolicy policy);
26
27 /**
28 * Remove the entries with the specified keys.
29 *
30 * @param keys the keys of the entries to remove.
31 */
32 @SuppressWarnings("unchecked")
33 default void remove(String... keys)
34 {
35 remove(Arrays.asList(keys));
36 }
37
38 /**
39 * Remove the entries with the specified keys.
40 *
41 * @param keys the keys of the entries to remove.
42 */
43 void remove(Iterable<String> keys);
44
45 /**
46 * Remove all entries in the cache.
47 */
48 void removeAll();
49 }