com.atlassian.cache
Interface ManagedCache


@Internal
public interface ManagedCache

Interface that managed cache things need to implement

Since:
2.0

Method Summary
 void clear()
          Clear the cache.
 Long currentExpireAfterAccessMillis()
           
 Long currentExpireAfterWriteMillis()
           
 Integer currentMaxEntries()
           
 String getName()
          The name of the cache, uniquely identifies this cache.
 boolean isFlushable()
          Returns true if this cache can be safely flushed any time.
 boolean isLocal()
           
 boolean isReplicateAsynchronously()
           
 boolean isReplicateViaCopy()
           
 boolean updateExpireAfterAccess(long expireAfter, TimeUnit timeUnit)
          Attempts to update the hint regarding how long entries that should be held in the cache, after last access.
 boolean updateExpireAfterWrite(long expireAfter, TimeUnit timeUnit)
          Attempts to update the hint regarding how long entries that should be held in the cache, after last write.
 boolean updateMaxEntries(int newValue)
          Attempts to update the hint regarding the maximum number of entries that should be cached at any time.
 

Method Detail

clear

void clear()
Clear the cache.


getName

String getName()
The name of the cache, uniquely identifies this cache.

Returns:
the name of the cache.

isFlushable

boolean isFlushable()
Returns true if this cache can be safely flushed any time.

This method is used by CacheManager.flushCaches() to only flush caches that can be safely flushed. clear() ignores this value.

Returns:
true if this cache can be flushed safely.

currentMaxEntries

Integer currentMaxEntries()
Returns:
the current hint regarding the maximum number of entries that should be cached at any time. null indicates no current hint

updateMaxEntries

boolean updateMaxEntries(int newValue)
Attempts to update the hint regarding the maximum number of entries that should be cached at any time.

Parameters:
newValue - the new hint value
Returns:
true iff the hint has been updated to the new value. If a cache does not support changes at run-time, it must return false

currentExpireAfterAccessMillis

Long currentExpireAfterAccessMillis()
Returns:
the current hint regarding how long entries should be held in the cache, after last access, measured in milliseconds. null indicates no current hint

updateExpireAfterAccess

boolean updateExpireAfterAccess(long expireAfter,
                                TimeUnit timeUnit)
Attempts to update the hint regarding how long entries that should be held in the cache, after last access.

Parameters:
expireAfter - Time to retain entries for since their last access.
timeUnit - The TimeUnit for the time
Returns:
true iff the hint has been updated to the new value. If a cache does not support changes at run-time, it must return false

currentExpireAfterWriteMillis

Long currentExpireAfterWriteMillis()
Returns:
the current hint regarding how long entries should be held in the cache, after last write, measured in milliseconds. null indicates no current hint

updateExpireAfterWrite

boolean updateExpireAfterWrite(long expireAfter,
                               TimeUnit timeUnit)
Attempts to update the hint regarding how long entries that should be held in the cache, after last write.

Parameters:
expireAfter - Time to retain entries for since their last write.
timeUnit - The TimeUnit for the time
Returns:
true iff the hint has been updated to the new value. If a cache does not support changes at run-time, it must return false

isLocal

boolean isLocal()
Returns:
true if the cache is local, and hence is not replicated in a clustered environment

isReplicateAsynchronously

boolean isReplicateAsynchronously()
Returns:
true if this cache should be replicated asynchronously in a clustered environment.

isReplicateViaCopy

boolean isReplicateViaCopy()
Returns:
true if this cache should, in a clustered environment, replicate put and update operations by copying the relevant key and value across the wire (as opposed to just the key).


Copyright © 2014 Atlassian. All Rights Reserved.