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 TypeMethodDescriptionvoidaddTaskToRefreshPersistentCache(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)voidRemoves all records from persistent cachevoiddeletePersistedRecord(long spaceId) Removes a record from the persistent cachevoidRemoves 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 futureintvoidCheck 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:
getSpaceRecordin interfaceAdaptiveMostUsedLabelsCache- Parameters:
spaceKey- - space keylimit- - limit- Returns:
- list of records
-
deleteAllPersistedRecords
public void deleteAllPersistedRecords()Removes all records from persistent cache- Specified by:
deleteAllPersistedRecordsin interfaceAdaptiveMostUsedLabelsCache
-
deletePersistedRecord
public void deletePersistedRecord(long spaceId) Removes a record from the persistent cache- Specified by:
deletePersistedRecordin 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:
deletePersistedRecordForSitein 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:
getSiteRecordin 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:
getSpaceRecordin 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
-