1 package com.atlassian.vcache;
2
3 import com.atlassian.annotations.PublicApi;
4
5 import java.util.Arrays;
6 import java.util.concurrent.CompletionStage;
7
8 /**
9 * Represents the unbuffered write operations on an {@link ExternalCache}.
10 *
11 * @param <V> the value type
12 * @since 1.0
13 */
14 @PublicApi
15 public interface ExternalWriteOperationsUnbuffered<V> {
16 /**
17 * Puts the value under the specified key using the specified policy.
18 *
19 * @param key the key to put the data under
20 * @param value the value to associate with the key.
21 * @param policy the policy to apply
22 * @return whether the entry was put into the cache.
23 */
24 CompletionStage<Boolean> put(String key, V value, PutPolicy policy);
25
26 /**
27 * Remove the entries with the specified keys.
28 *
29 * @param keys the keys of the entries to remove.
30 * @return no indication is given as to whether the entries existed before they were deleted
31 */
32 @SuppressWarnings("unchecked")
33 default CompletionStage<Void> remove(String... keys) {
34 return remove(Arrays.asList(keys));
35 }
36
37 /**
38 * Remove the entries with the specified keys.
39 *
40 * @param keys the keys of the entries to remove.
41 * @return no indication is given as to whether the entries existed before they were deleted
42 */
43 CompletionStage<Void> remove(Iterable<String> keys);
44
45 /**
46 * Remove all entries in the cache.
47 *
48 * @return no indication is given as to whether entries existed before they were deleted
49 */
50 CompletionStage<Void> removeAll();
51 }