Class AdaptiveMostUsedLabelsCacheImpl
- java.lang.Object
-
- com.atlassian.confluence.impl.labels.adaptivelabelcache.AdaptiveMostUsedLabelsCacheImpl
-
- All Implemented Interfaces:
AdaptiveMostUsedLabelsCache
public class AdaptiveMostUsedLabelsCacheImpl extends Object implements AdaptiveMostUsedLabelsCache
An implementation of AdaptiveMostUsedLabelsCache which stores data in a separate DB table- Since:
- 7.7.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AdaptiveMostUsedLabelsCacheImpl.TimestampProvider
-
Constructor Summary
Constructors Constructor Description AdaptiveMostUsedLabelsCacheImpl(AdaptiveMostUsedLabelsCacheImpl.TimestampProvider timestampProvider, AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate)
AdaptiveMostUsedLabelsCacheImpl(AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)void
deleteAllPersistedRecords()
Removes all records from persistent cachevoid
deletePersistedRecord(long spaceId)
Removes a record from the persistent cachevoid
deletePersistedRecordForSite()
Removes a cache record for the entire site (global most popular labels) Does not remove cache records for spacesList<LiteLabelSearchResult>
getSiteRecord(int limit)
Reads most used labels for the whole site Implementation can use its own hard limit if the provided limit is too largeList<LiteLabelSearchResult>
getSpaceRecord(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 largeList<LiteLabelSearchResult>
getSpaceRecord(String spaceKey, int limit)
A wrapper which allows to retrive data by space key (not by space id) Would be removed in the futureint
getTaskQueueSize()
void
scheduled()
Check the queue every N seconds and process all records from the queue
-
-
-
Constructor Detail
-
AdaptiveMostUsedLabelsCacheImpl
public AdaptiveMostUsedLabelsCacheImpl(AdaptiveMostUsedLabelsCacheImpl.TimestampProvider timestampProvider, AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate)
-
AdaptiveMostUsedLabelsCacheImpl
public AdaptiveMostUsedLabelsCacheImpl(AdaptiveLabelCacheDao adaptiveLabelCacheDao, LabelManagerInternal labelManagerDelegate)
-
-
Method Detail
-
getSpaceRecord
public List<LiteLabelSearchResult> getSpaceRecord(String spaceKey, int limit)
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
public List<LiteLabelSearchResult> getSiteRecord(int limit)
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
public List<LiteLabelSearchResult> getSpaceRecord(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 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
-
-