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
  • Constructor Details

  • Method Details

    • 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 interface AdaptiveMostUsedLabelsCache
      Parameters:
      spaceKey - - space key
      limit - - limit
      Returns:
      list of records
    • deleteAllPersistedRecords

      public void deleteAllPersistedRecords()
      Removes all records from persistent cache
      Specified by:
      deleteAllPersistedRecords in interface AdaptiveMostUsedLabelsCache
    • deletePersistedRecord

      public void deletePersistedRecord(long spaceId)
      Removes a record from the persistent cache
      Specified by:
      deletePersistedRecord in interface AdaptiveMostUsedLabelsCache
      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 interface AdaptiveMostUsedLabelsCache
    • 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 interface AdaptiveMostUsedLabelsCache
      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 interface AdaptiveMostUsedLabelsCache
      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 id
      requestedLimit - - limit
    • getTaskQueueSize

      public int getTaskQueueSize()
      Returns:
      tasks queue size