View Javadoc

1   package com.atlassian.vcache;
2   
3   import com.atlassian.annotations.PublicApi;
4   
5   import java.util.Arrays;
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   * @since 1.0
13   */
14  @PublicApi
15  public interface ExternalWriteOperationsBuffered<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       */
23      void put(String key, V value, PutPolicy policy);
24  
25      /**
26       * Remove the entries with the specified keys.
27       *
28       * @param keys the keys of the entries to remove.
29       */
30      @SuppressWarnings("unchecked")
31      default void remove(String... keys) {
32          remove(Arrays.asList(keys));
33      }
34  
35      /**
36       * Remove the entries with the specified keys.
37       *
38       * @param keys the keys of the entries to remove.
39       */
40      void remove(Iterable<String> keys);
41  
42      /**
43       * Remove all entries in the cache.
44       */
45      void removeAll();
46  }