View Javadoc

1   package com.atlassian.vcache.internal;
2   
3   import com.atlassian.vcache.DirectExternalCache;
4   import com.atlassian.vcache.ExternalCacheSettings;
5   import com.atlassian.vcache.StableReadExternalCache;
6   import com.atlassian.vcache.TransactionalExternalCache;
7   
8   /**
9    * Details for a configured {@link com.atlassian.vcache.ExternalCache}
10   *
11   * @since 1.0
12   */
13  public interface ExternalCacheDetails {
14      /**
15       * Represents the different buffering policies for {@link com.atlassian.vcache.ExternalCache} instances.
16       */
17      enum BufferPolicy {
18          /**
19           * Corresponds to {@link DirectExternalCache}.
20           */
21          NEVER(false, false),
22          /**
23           * Corresponds to {@link StableReadExternalCache}.
24           */
25          READ_ONLY(true, false),
26          /**
27           * Corresponds to {@link TransactionalExternalCache}.
28           */
29          FULLY(true, true);
30  
31          private final boolean readBuffered;
32          private final boolean writeBuffered;
33  
34          BufferPolicy(boolean readBuffered, boolean writeBuffered) {
35              this.readBuffered = readBuffered;
36              this.writeBuffered = writeBuffered;
37          }
38  
39          boolean isReadBuffered() {
40              return readBuffered;
41          }
42  
43          boolean isWriteBuffered() {
44              return writeBuffered;
45          }
46      }
47  
48      /**
49       * The name of the cache, uniquely identifies this cache.
50       *
51       * @return the name of the cache
52       */
53      String getName();
54  
55      BufferPolicy getPolicy();
56  
57      ExternalCacheSettings getSettings();
58  }