Class ReadThroughCachingBandanaPersister

  • All Implemented Interfaces:
    com.atlassian.bandana.BandanaPersister

    @ParametersAreNonnullByDefault
    public class ReadThroughCachingBandanaPersister
    extends Object
    implements com.atlassian.bandana.BandanaPersister
    An implementation of BandanaPersister which caches the data from another BandanaPersister.
    Since:
    7.5
    • Method Detail

      • retrieve

        public @Nullable Object retrieve​(com.atlassian.bandana.BandanaContext context,
                                         String key)
        Retrieves the value associated with the key from the given context. If the context does not exist, or the key is not found in the context, this method returns null.

        Assumes that any BandanaContext we are passed is a KeyedBandanaContext because that's how Confluence uses Bandana.

        Specified by:
        retrieve in interface com.atlassian.bandana.BandanaPersister
      • retrieve

        public Map<String,​Object> retrieve​(com.atlassian.bandana.BandanaContext context)
        This implementation is extremely processor intensive but correct. The assumption is that this method NEVER gets called.
        Specified by:
        retrieve in interface com.atlassian.bandana.BandanaPersister
        Parameters:
        context - context to retrieve content for.
        Returns:
        a Map from String key to Object value
      • retrieveKeys

        public Iterable<String> retrieveKeys​(com.atlassian.bandana.BandanaContext bandanaContext)
        Bypass the cache
        Specified by:
        retrieveKeys in interface com.atlassian.bandana.BandanaPersister
        Parameters:
        bandanaContext - the context for which to get keys
        Returns:
        the keys for the given context
      • store

        public void store​(com.atlassian.bandana.BandanaContext context,
                          String key,
                          @Nullable Object value)
        Specified by:
        store in interface com.atlassian.bandana.BandanaPersister
      • flushCaches

        public void flushCaches()
        Specified by:
        flushCaches in interface com.atlassian.bandana.BandanaPersister
      • remove

        public void remove​(com.atlassian.bandana.BandanaContext context)
        Specified by:
        remove in interface com.atlassian.bandana.BandanaPersister
      • remove

        public void remove​(com.atlassian.bandana.BandanaContext context,
                           String key)
        Specified by:
        remove in interface com.atlassian.bandana.BandanaPersister