Class AdaptiveMostUsedLabelsCacheImpl
java.lang.Object
com.atlassian.confluence.impl.labels.adaptivelabelcache.AdaptiveMostUsedLabelsCacheImpl
- All Implemented Interfaces:
AdaptiveMostUsedLabelsCache
An implementation of AdaptiveMostUsedLabelsCache which stores data in a separate DB table
- Since:
- 7.7.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAdaptiveMostUsedLabelsCacheImpl
(AdaptiveMostUsedLabelsCacheImpl.TimestampProvider timestampProvider, AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate) AdaptiveMostUsedLabelsCacheImpl
(AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTaskToRefreshPersistentCache
(long spaceId, int requestedLimit) Adds a new task for refreshing cache records in the queue If there is another cache record in the queue, we should not add a new one We need to update the existing one (if required)void
Removes all records from persistent cachevoid
deletePersistedRecord
(long spaceId) Removes a record from the persistent cachevoid
Removes a cache record for the entire site (global most popular labels) Does not remove cache records for spacesgetSiteRecord
(int limit) Reads most used labels for the whole site Implementation can use its own hard limit if the provided limit is too largegetSpaceRecord
(long spaceId, int limit) Reads most used labels for the particular space from cache Implementation can use its own hard limit if the provided limit is too largegetSpaceRecord
(String spaceKey, int limit) A wrapper which allows to retrive data by space key (not by space id) Would be removed in the futureint
void
Check the queue every N seconds and process all records from the queue
-
Constructor Details
-
AdaptiveMostUsedLabelsCacheImpl
public AdaptiveMostUsedLabelsCacheImpl(AdaptiveMostUsedLabelsCacheImpl.TimestampProvider timestampProvider, AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate) -
AdaptiveMostUsedLabelsCacheImpl
public AdaptiveMostUsedLabelsCacheImpl(AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate)
-
-
Method Details
-
getSpaceRecord
A wrapper which allows to retrive data by space key (not by space id) Would be removed in the future- Specified by:
getSpaceRecord
in interfaceAdaptiveMostUsedLabelsCache
- Parameters:
spaceKey
- - space keylimit
- - limit- Returns:
- list of records
-
deleteAllPersistedRecords
public void deleteAllPersistedRecords()Removes all records from persistent cache- Specified by:
deleteAllPersistedRecords
in interfaceAdaptiveMostUsedLabelsCache
-
deletePersistedRecord
public void deletePersistedRecord(long spaceId) Removes a record from the persistent cache- Specified by:
deletePersistedRecord
in interfaceAdaptiveMostUsedLabelsCache
- Parameters:
spaceId
- - space id
-
deletePersistedRecordForSite
public void deletePersistedRecordForSite()Removes a cache record for the entire site (global most popular labels) Does not remove cache records for spaces- Specified by:
deletePersistedRecordForSite
in interfaceAdaptiveMostUsedLabelsCache
-
scheduled
@Scheduled(fixedDelay=3000L) public void scheduled()Check the queue every N seconds and process all records from the queue -
getSiteRecord
Reads most used labels for the whole site Implementation can use its own hard limit if the provided limit is too large- Specified by:
getSiteRecord
in interfaceAdaptiveMostUsedLabelsCache
- Parameters:
limit
- - limit- Returns:
- cached data
-
getSpaceRecord
Reads most used labels for the particular space from cache Implementation can use its own hard limit if the provided limit is too large- Specified by:
getSpaceRecord
in interfaceAdaptiveMostUsedLabelsCache
- Parameters:
spaceId
- - space id- Returns:
- cached data
-
addTaskToRefreshPersistentCache
public void addTaskToRefreshPersistentCache(long spaceId, int requestedLimit) Adds a new task for refreshing cache records in the queue If there is another cache record in the queue, we should not add a new one We need to update the existing one (if required)- Parameters:
spaceId
- - space idrequestedLimit
- - limit
-
getTaskQueueSize
public int getTaskQueueSize()- Returns:
- tasks queue size
-