com.atlassian.bamboo.plan.cache
Interface ImmutablePlanCacheService

All Known Implementing Classes:
ImmutablePlanCacheServiceImpl

@ExperimentalApi
@Internal
public interface ImmutablePlanCacheService

An experimental API for getting immutable, weakly held, cached ImmutableChain. This Service does not check for permissions currently. Only works for Chain. Cache is disabled by default and should be explicitly enabled by application (preferably by calling initialiseCache())
Concepts:

cache invalidation
Temporary removal of plan from cache (ie as an effect of changed plan configuration). Cache invalidation will remove Plan from cache but will not remove metadata information (ie planKey->id mapping)
cache reset
Permament removal of plan from cache (ie as an effect of plan deletion or move to another project). Cache reset will remove Plan and all related data from the cache.
This class is for internal use only, you should probably be using CachedPlanManager instead. In 3.4, only used for Dashboard Cache

Since:
v3.4

Nested Class Summary
static interface ImmutablePlanCacheService.CacheInvalidator
           
 
Method Summary
 void cascadeInvalidate(long planId)
          Removes the cached reference for the passed plan and its children.
 void cascadeInvalidate(PlanKey planKey)
          Removes the cached reference for the passed plan and its children.
 void disableCache()
          Disable cache.
 void enableCache()
          Enable cache.
 int[] getBuildNumberOverrides(PlanKey planKey)
          Deprecated. since 4.4
 BambooCacheStats getCacheStats()
          Retrieve cache statistics
 Iterable<PlanKey> getChainsToInvalidate(ImmutablePlanCacheService.CacheInvalidator invalidator)
          Internal.
 ImmutableChain getImmutablePlanByKey(PlanKey planKey)
          Returns a plan if one exists with the key.
 PlanCacheIndices getIndices()
          Returns the indices created for plan cache content.
 ReentrantReadWriteLock getLock(PlanKey planKey)
          Makes plan inaccessible
 PlanIdentifier getPlanIdentifierForPermissionCheckingByKey(PlanKey planKey)
          Deprecated. since 5.4 use CachedPlanManager.getPlanByKey(com.atlassian.bamboo.plan.PlanKey)
<T extends ImmutablePlan>
List<T>
getPlans(Class<T> planType)
          Returns all Plan's filtered by Class.
<T extends ImmutablePlan>
List<T>
getPlans(Class<T> planType, com.google.common.base.Predicate<? super T> filter)
          Returns all Plan's filtered by Class.
 void initialiseCache()
          Clear the cache and attempt to read all Chains from DB in order to cache them.
 void invalidate(PlanKey planKey)
          Removes the cached Plan.
 void reset(PlanKey planKey)
          Removes the cached Plan and its metadata.
 void resetAll()
          Nukes the cache
 void setBuildNumberOverrides(PlanKey planKey, int firstBuildNumber, int lastBuildNumber, int nextBuildNumber)
          Deprecated. since 4.4
 

Method Detail

getImmutablePlanByKey

@Nullable
ImmutableChain getImmutablePlanByKey(@NotNull
                                              PlanKey planKey)
Returns a plan if one exists with the key.

Parameters:
planKey -
Returns:

getPlans

@NotNull
<T extends ImmutablePlan> List<T> getPlans(Class<T> planType)
Returns all Plan's filtered by Class. Does not include plans marked for deletion.

Parameters:
planType - - the type of the plan to retrieve
Returns:
plans sorted by DescriptionProvider.getName()

getPlans

@NotNull
<T extends ImmutablePlan> List<T> getPlans(Class<T> planType,
                                                   @NotNull
                                                   com.google.common.base.Predicate<? super T> filter)
Returns all Plan's filtered by Class. Does not include plans marked for deletion.

Parameters:
planType - - the type of the plan to retrieve
Returns:
plans sorted by DescriptionProvider.getName()

getPlanIdentifierForPermissionCheckingByKey

@Nullable
@Deprecated
PlanIdentifier getPlanIdentifierForPermissionCheckingByKey(@NotNull
                                                                               PlanKey planKey)
Deprecated. since 5.4 use CachedPlanManager.getPlanByKey(com.atlassian.bamboo.plan.PlanKey)


getLock

ReentrantReadWriteLock getLock(@NotNull
                               PlanKey planKey)
Makes plan inaccessible

Parameters:
planKey - key of the Plan to be made inaccessible

invalidate

void invalidate(@NotNull
                PlanKey planKey)
Removes the cached Plan. Retains Plan metadata.

Parameters:
planKey - key of the Plan to be removed from cache

cascadeInvalidate

void cascadeInvalidate(@NotNull
                       PlanKey planKey)
Removes the cached reference for the passed plan and its children. Currently only propagates invalidation from Chain to ChainBranch

Parameters:
planKey - key of the Plan to be removed from cache

cascadeInvalidate

void cascadeInvalidate(long planId)
Removes the cached reference for the passed plan and its children. Currently only propagates invalidation from Chain to ChainBranch

Parameters:
planId -

reset

void reset(@NotNull
           PlanKey planKey)
Removes the cached Plan and its metadata.

Parameters:
planKey - key of the Plan to be removed from cache

resetAll

void resetAll()
Nukes the cache


initialiseCache

void initialiseCache()
Clear the cache and attempt to read all Chains from DB in order to cache them. If cache was disabled it will be enabled by this method.


disableCache

void disableCache()
Disable cache. When cache is disabled all cache requests will be logged with severity WARN until cache will be enabled again. This method will clear cache.


enableCache

void enableCache()
Enable cache. This method will not load anything when it is enabled, you should consider calling initialiseCache() instead if you expect plans to be loaded.


getCacheStats

BambooCacheStats getCacheStats()
Retrieve cache statistics

Returns:
Cache statistics

setBuildNumberOverrides

@Deprecated
@Internal
void setBuildNumberOverrides(PlanKey planKey,
                                                 int firstBuildNumber,
                                                 int lastBuildNumber,
                                                 int nextBuildNumber)
Deprecated. since 4.4

internal use only.


getBuildNumberOverrides

@Deprecated
@Internal
@Nullable
int[] getBuildNumberOverrides(PlanKey planKey)
Deprecated. since 4.4

internal use only.


getChainsToInvalidate

@Internal
@NotNull
Iterable<PlanKey> getChainsToInvalidate(@NotNull
                                                         ImmutablePlanCacheService.CacheInvalidator invalidator)
Internal. Calls apply on the supplied ImmutablePlanCacheService.CacheInvalidator

Parameters:
invalidator -

getIndices

@NotNull
PlanCacheIndices getIndices()
Returns the indices created for plan cache content.



Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.