View Javadoc
1   package com.atlassian.cache;
2   
3   import java.util.Collection;
4   
5   import javax.annotation.Nonnull;
6   import javax.annotation.Nullable;
7   
8   import com.atlassian.annotations.Internal;
9   
10  @Internal
11  public interface CacheManager extends CacheFactory
12  {
13      /**
14       * Gets the collection of caches managed. This collection is not a "live" collection. It is a copy.
15       * @return a collection of {@link Cache}s. The returned collection will only include caches created via
16       * the {@code getCache(...)} methods. Caches created via the {@code getCachedReference(...)}
17       * methods are not included.
18       * @deprecated Since 2.0.  Use {@link #getManagedCaches()} instead.
19       */
20      @Deprecated
21      @Nonnull
22      Collection<Cache<?, ?>> getCaches();
23  
24      /**
25       * Gets the collection of caches managed. This collection is not a "live" collection. It is a copy. The
26       * returned collection will include caches created via both the {@code getCache(...)} and
27       * {@code getCachedReference(...)} methods.
28       * @return a collection of {@link ManagedCache}s.
29       */
30      @Nonnull
31      Collection<ManagedCache> getManagedCaches();
32  
33      /**
34       * Flush the contents of all flushable caches registered with the cache manager.
35       *
36       * @see com.atlassian.cache.CacheSettings#getFlushable()
37       */
38      void flushCaches();
39  
40      /**
41       * Returns the managed cache for the specified name.
42       *
43       * @param name the name of the managed cache to retrieve
44       * @return the {@link com.atlassian.cache.ManagedCache} specified by <tt>name</tt>
45       *         or <tt>null</tt> if no cache exists.
46       * @since 2.3.0
47       */
48      @Nullable
49      ManagedCache getManagedCache(@Nonnull String name);
50  
51      /**
52       * Shuts down and clean all data of the current instance and its all caches.
53       *
54       * @since 2.4.0
55       */
56      void shutdown();
57  }