Class ProfileCacheImpl
java.lang.Object
com.sportradar.unifiedodds.sdk.internal.caching.impl.ProfileCacheImpl
- All Implemented Interfaces:
DataRouterListener,ProfileCache,ExportableSdkCache
public class ProfileCacheImpl
extends Object
implements ProfileCache, DataRouterListener, ExportableSdkCache
The main competitor/profile cache
-
Constructor Summary
ConstructorsConstructorDescriptionProfileCacheImpl(CacheItemFactory cacheItemFactory, DataRouterManager dataRouterManager, com.google.common.cache.Cache<Urn, PlayerProfileCi> playerCache, com.google.common.cache.Cache<Urn, CompetitorCi> competitorCache, com.google.common.cache.Cache<Urn, CompetitorCi> simpleTeamCache) -
Method Summary
Modifier and TypeMethodDescriptionReturns current cache statusExports current items in the cachegetCompetitorProfile(Urn id, List<Locale> locales) Returns aCompetitorCiassociated with the providedUrnReturns aPlayerProfileCiassociated with the providedUrnvoidimportItems(List<ExportableCi> items) Imports provided items into the cachevoidonCompetitorFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiCompetitorProfileEndpoint data, Locale dataLocale, CacheItem requester) voidonPlayerCompetitorFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiPlayerCompetitor data, Locale dataLocale, CacheItem requester, Urn competitorId) voidonPlayerFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiPlayerExtended data, Locale dataLocale, CacheItem requester, Urn competitorId) voidonSimpleTeamFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiSimpleTeamProfileEndpoint data, Locale dataLocale, CacheItem requester) voidonTeamFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiTeam data, Locale dataLocale, CacheItem requester) voidpurgeCompetitorProfileCacheItem(Urn competitorId) Purges the associated competitor cache itemvoidpurgePlayerProfileCacheItem(Urn playerId) Purges the associated player profile cache itemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sportradar.unifiedodds.sdk.internal.caching.DataRouterListener
onAvailableSelectionsFetched, onCalculateProbabilityFetched, onCalculateProbabilityFilterFetched, onChildSportEventFetched, onDrawFetched, onDrawSummaryEndpointFetched, onFixtureFetched, onLotteryFetched, onMatchSummaryEndpointFetched, onMatchTimelineFetched, onSportCategoriesFetched, onSportEventFetched, onSportEventStatusFetched, onSportFetched, onSportTournamentsFetched, onStageSummaryEndpointFetched, onTournamentExtendedFetched, onTournamentFetched, onTournamentInfoEndpointFetched
-
Constructor Details
-
ProfileCacheImpl
public ProfileCacheImpl(CacheItemFactory cacheItemFactory, DataRouterManager dataRouterManager, com.google.common.cache.Cache<Urn, PlayerProfileCi> playerCache, com.google.common.cache.Cache<Urn, CompetitorCi> competitorCache, com.google.common.cache.Cache<Urn, CompetitorCi> simpleTeamCache)
-
-
Method Details
-
getPlayerProfile
public PlayerProfileCi getPlayerProfile(Urn id, List<Locale> locales, List<Urn> possibleAssociatedCompetitorIds) throws CacheItemNotFoundException Returns aPlayerProfileCiassociated with the providedUrn- Specified by:
getPlayerProfilein interfaceProfileCache- Parameters:
id- the uniqueUrnidentifier of the playerlocales- aListof locales in which the data is requiredpossibleAssociatedCompetitorIds- a list of possible associated competitors, used to prefetch competitor profiles- Returns:
- a
PlayerProfileCiassociated with the providedUrn - Throws:
CacheItemNotFoundException
-
getCompetitorProfile
public CompetitorCi getCompetitorProfile(Urn id, List<Locale> locales) throws CacheItemNotFoundException Returns aCompetitorCiassociated with the providedUrn- Specified by:
getCompetitorProfilein interfaceProfileCache- Parameters:
id- the uniqueUrnidentifier of the competitorlocales- aListof locales in which the data is required- Returns:
- a
CompetitorCiassociated with the providedUrn - Throws:
CacheItemNotFoundException
-
purgeCompetitorProfileCacheItem
Purges the associated competitor cache item- Specified by:
purgeCompetitorProfileCacheItemin interfaceProfileCache- Parameters:
competitorId- the identifier of the cache item to purge
-
purgePlayerProfileCacheItem
Purges the associated player profile cache item- Specified by:
purgePlayerProfileCacheItemin interfaceProfileCache- Parameters:
playerId- the identifier of the cache item to purge
-
onPlayerFetched
public void onPlayerFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiPlayerExtended data, Locale dataLocale, CacheItem requester, Urn competitorId) - Specified by:
onPlayerFetchedin interfaceDataRouterListener
-
onPlayerCompetitorFetched
-
onCompetitorFetched
public void onCompetitorFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiCompetitorProfileEndpoint data, Locale dataLocale, CacheItem requester) - Specified by:
onCompetitorFetchedin interfaceDataRouterListener
-
onTeamFetched
public void onTeamFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiTeam data, Locale dataLocale, CacheItem requester) - Specified by:
onTeamFetchedin interfaceDataRouterListener
-
onSimpleTeamFetched
public void onSimpleTeamFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiSimpleTeamProfileEndpoint data, Locale dataLocale, CacheItem requester) - Specified by:
onSimpleTeamFetchedin interfaceDataRouterListener
-
exportItems
Exports current items in the cache- Specified by:
exportItemsin interfaceExportableSdkCache- Returns:
- List of
ExportableCicontaining all the items currently in the cache
-
importItems
Imports provided items into the cache- Specified by:
importItemsin interfaceExportableSdkCache- Parameters:
items- List ofExportableCito be inserted into the cache
-
cacheStatus
Returns current cache status- Specified by:
cacheStatusin interfaceExportableSdkCache- Returns:
- A map containing all cache item types in the cache and their counts
-