Class SportsDataCacheImpl
java.lang.Object
com.sportradar.unifiedodds.sdk.internal.caching.impl.SportsDataCacheImpl
- All Implemented Interfaces:
DataRouterListener,SportsDataCache,ExportableSdkCache
public class SportsDataCacheImpl
extends Object
implements SportsDataCache, DataRouterListener, ExportableSdkCache
Implements methods used to access various sport events data
-
Constructor Summary
ConstructorsConstructorDescriptionSportsDataCacheImpl(com.google.common.cache.Cache<Urn, SportCi> sportsCache, com.google.common.cache.Cache<Urn, CategoryCi> categoriesCache, CacheItemFactory cacheItemFactory, DataRouterManager dataRouterManager) -
Method Summary
Modifier and TypeMethodDescriptionReturns current cache statusExports current items in the cachegetCategory(Urn categoryId, List<Locale> locales) Returns the associated category dataReturns aListsports supported by the feed.voidimportItems(List<ExportableCi> items) Imports provided items into the cachevoidonFixtureFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiFixture data, Locale dataLocale, CacheItem requester) voidonLotteryFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiLottery data, Locale locale, CacheItem requester) voidonMatchSummaryEndpointFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiMatchSummaryEndpoint data, Locale dataLocale, CacheItem requester) voidonMatchTimelineFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiMatchTimelineEndpoint data, Locale dataLocale, CacheItem requester) voidonSportCategoriesFetched(Urn sportId, com.sportradar.uf.sportsapi.datamodel.SapiSportCategoriesEndpoint data, Locale locale, CacheItem requester) voidonSportEventFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiSportEvent data, Locale dataLocale) voidonSportFetched(Urn sportId, com.sportradar.uf.sportsapi.datamodel.SapiSport sport, Locale dataLocale) voidonStageSummaryEndpointFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiStageSummaryEndpoint data, Locale dataLocale, CacheItem requester) voidonTournamentExtendedFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiTournamentExtended data, Locale dataLocale) voidonTournamentFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiTournament data, Locale locale) voidonTournamentInfoEndpointFetched(Urn requestedId, Urn tournamentId, Urn seasonId, com.sportradar.uf.sportsapi.datamodel.SapiTournamentInfoEndpoint data, Locale dataLocale, CacheItem requester) Methods 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, onCompetitorFetched, onDrawFetched, onDrawSummaryEndpointFetched, onPlayerFetched, onSimpleTeamFetched, onSportEventStatusFetched, onSportTournamentsFetched, onTeamFetched
-
Constructor Details
-
SportsDataCacheImpl
@Inject public SportsDataCacheImpl(com.google.common.cache.Cache<Urn, SportCi> sportsCache, com.google.common.cache.Cache<Urn, CategoryCi> categoriesCache, CacheItemFactory cacheItemFactory, DataRouterManager dataRouterManager)
-
-
Method Details
-
getSports
Returns aListsports supported by the feed.- Specified by:
getSportsin interfaceSportsDataCache- Parameters:
locales- aListofLocalespecifying the languages in which the data is returned- Returns:
- a
Listsports supported by the feed - Throws:
IllegalCacheStateException
-
getSport
public SportData getSport(Urn sportId, List<Locale> locales) throws IllegalCacheStateException, CacheItemNotFoundException - Specified by:
getSportin interfaceSportsDataCache- Parameters:
sportId- aUrnspecifying the id of the sportlocales- aListofLocalespecifying the languages in which the data is returned- Returns:
- a
SportDatacontaining information about the requested sport - Throws:
IllegalCacheStateExceptionCacheItemNotFoundException
-
getCategory
public CategoryCi getCategory(Urn categoryId, List<Locale> locales) throws IllegalCacheStateException, CacheItemNotFoundException Returns the associated category data- Specified by:
getCategoryin interfaceSportsDataCache- Parameters:
categoryId- the identifier of the categorylocales- the locales in which to provide the data- Returns:
- the category data of the category associated with the provided identifier
- Throws:
IllegalCacheStateException- if the cache load failedCacheItemNotFoundException- if the cache item could not be found - category does not exists in the cache/api
-
onSportEventFetched
public void onSportEventFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiSportEvent data, Locale dataLocale) - Specified by:
onSportEventFetchedin interfaceDataRouterListener
-
onTournamentFetched
public void onTournamentFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiTournament data, Locale locale) - Specified by:
onTournamentFetchedin interfaceDataRouterListener
-
onTournamentExtendedFetched
public void onTournamentExtendedFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiTournamentExtended data, Locale dataLocale) - Specified by:
onTournamentExtendedFetchedin interfaceDataRouterListener
-
onTournamentInfoEndpointFetched
public void onTournamentInfoEndpointFetched(Urn requestedId, Urn tournamentId, Urn seasonId, com.sportradar.uf.sportsapi.datamodel.SapiTournamentInfoEndpoint data, Locale dataLocale, CacheItem requester) - Specified by:
onTournamentInfoEndpointFetchedin interfaceDataRouterListener
-
onStageSummaryEndpointFetched
public void onStageSummaryEndpointFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiStageSummaryEndpoint data, Locale dataLocale, CacheItem requester) - Specified by:
onStageSummaryEndpointFetchedin interfaceDataRouterListener
-
onMatchSummaryEndpointFetched
public void onMatchSummaryEndpointFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiMatchSummaryEndpoint data, Locale dataLocale, CacheItem requester) - Specified by:
onMatchSummaryEndpointFetchedin interfaceDataRouterListener
-
onFixtureFetched
public void onFixtureFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiFixture data, Locale dataLocale, CacheItem requester) - Specified by:
onFixtureFetchedin interfaceDataRouterListener
-
onSportFetched
public void onSportFetched(Urn sportId, com.sportradar.uf.sportsapi.datamodel.SapiSport sport, Locale dataLocale) - Specified by:
onSportFetchedin interfaceDataRouterListener
-
onMatchTimelineFetched
public void onMatchTimelineFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiMatchTimelineEndpoint data, Locale dataLocale, CacheItem requester) - Specified by:
onMatchTimelineFetchedin interfaceDataRouterListener
-
onLotteryFetched
public void onLotteryFetched(Urn id, com.sportradar.uf.sportsapi.datamodel.SapiLottery data, Locale locale, CacheItem requester) - Specified by:
onLotteryFetchedin interfaceDataRouterListener
-
onSportCategoriesFetched
public void onSportCategoriesFetched(Urn sportId, com.sportradar.uf.sportsapi.datamodel.SapiSportCategoriesEndpoint data, Locale locale, CacheItem requester) - Specified by:
onSportCategoriesFetchedin 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
-