Class DatabaseBasedAdaptiveLabelCacheDaoImpl
- java.lang.Object
-
- com.atlassian.confluence.impl.labels.adaptivelabelcache.dao.DatabaseBasedAdaptiveLabelCacheDaoImpl
-
- All Implemented Interfaces:
AdaptiveLabelCacheDao
public class DatabaseBasedAdaptiveLabelCacheDaoImpl extends Object implements AdaptiveLabelCacheDao
An implementation which uses a separate table for storing persisted data- Since:
- 7.7.0
-
-
Constructor Summary
Constructors Constructor Description DatabaseBasedAdaptiveLabelCacheDaoImpl(org.hibernate.SessionFactory sessionFactory, SpaceDao spaceDao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clears all the recordslong
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 idString
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 idLiteSearchResultCacheEntry
read(long spaceId)
Reads cached record by space id.void
removeRecord(long spaceId)
Removes a recordvoid
removeRecordsExpiredAfter(long timestamp)
Clears expired recordsvoid
write(long spaceId, LiteSearchResultCacheEntry cacheEntry)
Writes cached data to the persistent cache A previous record will be overwritten
-
-
-
Constructor Detail
-
DatabaseBasedAdaptiveLabelCacheDaoImpl
public DatabaseBasedAdaptiveLabelCacheDaoImpl(org.hibernate.SessionFactory sessionFactory, SpaceDao spaceDao)
-
-
Method Detail
-
read
public LiteSearchResultCacheEntry read(long spaceId)
Reads cached record by space id. If cached record is expired, it will be returned anyway- Specified by:
read
in interfaceAdaptiveLabelCacheDao
- Parameters:
spaceId
- - space id- Returns:
- cached data
-
clear
public void clear()
Clears all the records- Specified by:
clear
in interfaceAdaptiveLabelCacheDao
-
removeRecordsExpiredAfter
public void removeRecordsExpiredAfter(long timestamp)
Clears expired records- Specified by:
removeRecordsExpiredAfter
in interfaceAdaptiveLabelCacheDao
- Parameters:
timestamp
- - timestamp
-
removeRecord
public void removeRecord(long spaceId)
Description copied from interface:AdaptiveLabelCacheDao
Removes a record- Specified by:
removeRecord
in interfaceAdaptiveLabelCacheDao
- Parameters:
spaceId
- - space id
-
write
public void write(long spaceId, LiteSearchResultCacheEntry cacheEntry)
Writes cached data to the persistent cache A previous record will be overwritten- Specified by:
write
in interfaceAdaptiveLabelCacheDao
- Parameters:
spaceId
- - space idcacheEntry
- - cache entry
-
getSpaceKeyFromSpaceId
public 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- Specified by:
getSpaceKeyFromSpaceId
in interfaceAdaptiveLabelCacheDao
- Parameters:
spaceId
- - space id- Returns:
- space key
- Since:
- 7.7.0
-
getSpaceIdByKey
public 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- Specified by:
getSpaceIdByKey
in interfaceAdaptiveLabelCacheDao
- Parameters:
spaceKey
- - space key- Returns:
- space key
- Since:
- 7.7.0
-
-