View Javadoc

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