Interface AdaptiveLabelCacheDao

  • All Known Implementing Classes:
    DatabaseBasedAdaptiveLabelCacheDaoImpl

    @Transactional(propagation=REQUIRES_NEW)
    public interface AdaptiveLabelCacheDao
    Allows to read and write records to a storage (for example, database) Any implementation must guarantee that data is available after a restart
    Since:
    7.7.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Clears all the records
      long getSpaceIdByKey​(String spaceKey)
      LabelManager does not work with space ids (only with space keys) So this method is required to retrieve spaces and get their ids Could be removed when LabelManager start supporting finding most used labels by space id
      String getSpaceKeyFromSpaceId​(long spaceId)
      LabelManager does not work with space ids (only with space keys) So this method is required to retrieve spaces and get their keys Could be removed when LabelManager start supporting finding most used labels by space id
      LiteSearchResultCacheEntry read​(long spaceId)
      Reads cached record by space id.
      void removeRecord​(long spaceId)
      Removes a record
      void removeRecordsExpiredAfter​(long timestamp)
      Clears expired records
      void write​(long spaceId, LiteSearchResultCacheEntry cacheEntry)
      Writes cached data to the persistent cache A previous record will be overwritten
    • Method Detail

      • read

        LiteSearchResultCacheEntry read​(long spaceId)
        Reads cached record by space id. If cached record is expired, it will be returned anyway
        Parameters:
        spaceId - - space id
        Returns:
        cached data
        Since:
        7.7.0
      • write

        void write​(long spaceId,
                   LiteSearchResultCacheEntry cacheEntry)
        Writes cached data to the persistent cache A previous record will be overwritten
        Parameters:
        spaceId - - space id
        cacheEntry - - cache entry
        Since:
        7.7.0
      • clear

        void clear()
        Clears all the records
        Since:
        7.7.0
      • removeRecordsExpiredAfter

        void removeRecordsExpiredAfter​(long timestamp)
        Clears expired records
        Parameters:
        timestamp - - timestamp
        Since:
        7.7.0
      • removeRecord

        void removeRecord​(long spaceId)
        Removes a record
        Parameters:
        spaceId - - space id
        Since:
        7.7.0
      • getSpaceKeyFromSpaceId

        @Transactional(readOnly=true)
        String getSpaceKeyFromSpaceId​(long spaceId)
        LabelManager does not work with space ids (only with space keys) So this method is required to retrieve spaces and get their keys Could be removed when LabelManager start supporting finding most used labels by space id
        Parameters:
        spaceId - - space id
        Returns:
        space key
        Since:
        7.7.0
      • getSpaceIdByKey

        @Transactional(readOnly=true)
        long getSpaceIdByKey​(String spaceKey)
        LabelManager does not work with space ids (only with space keys) So this method is required to retrieve spaces and get their ids Could be removed when LabelManager start supporting finding most used labels by space id
        Parameters:
        spaceKey - - space key
        Returns:
        space key
        Since:
        7.7.0