111 lines
5.6 KiB
C++
111 lines
5.6 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// (c) Copyright, Ubisoft Entertainment Inc. || Created by Harbour //
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
#include "ubiservices/services/cacheManager.h"
|
|
#if defined(US_SDK_SERVER)
|
|
#error This file shall not be part of the solution
|
|
#endif
|
|
|
|
#include "ubiservices/core/configs/configpriv.h"
|
|
#include "ubiservices/facadeInternal.h"
|
|
#if defined(US_MODULE_BATTLEPASS)
|
|
#include "ubiservices/services/battlepass/battlepassProxy.h"
|
|
#endif
|
|
#include "ubiservices/services/cacheInvalidationPolicy.h"
|
|
#if defined(US_MODULE_CLUB)
|
|
#include "ubiservices/services/club/sessionManagerClubProxy.h"
|
|
#endif
|
|
#if defined(US_MODULE_FRIEND)
|
|
#include "ubiservices/services/friend/friendClientProxy.h"
|
|
#endif
|
|
#if defined(US_MODULE_NEWS)
|
|
#include "ubiservices/services/news/newsProxy.h"
|
|
#endif
|
|
#include "ubiservices/services/parameters/parametersClientProxy.h"
|
|
#include "ubiservices/services/populations/populationsProxy.h"
|
|
#if defined(US_MODULE_PROFILE)
|
|
#include "ubiservices/services/profile/profileProxy.h"
|
|
#endif
|
|
#if defined(US_PRIMARY_STORE_ENABLED)
|
|
#include "ubiservices/services/secondaryStore/sessionManagerStoreProxy.h"
|
|
#endif
|
|
#if defined(US_MODULE_USER)
|
|
#include "ubiservices/services/user/userLegalOptinsStatusProxy.h"
|
|
#include "ubiservices/services/user/userLocalizationProxy.h"
|
|
#include "ubiservices/services/user/userStatusProxy.h"
|
|
#endif
|
|
#if defined(US_MODULE_SSI)
|
|
#include "ubiservices/services/secondaryStoreInstantiation/storeAttributesAllProxy.h"
|
|
#include "ubiservices/services/secondaryStoreInstantiation/storeListsOfAttributesAllProxy.h"
|
|
#include "ubiservices/services/secondaryStoreInstantiation/storeRulesAllProxy.h"
|
|
#endif
|
|
#include "ubiservices/sessionManager.h"
|
|
|
|
namespace US_NS {;
|
|
|
|
void CacheManager::invalidateCaches(FacadeInternal& facade)
|
|
{
|
|
CacheInvalidationPolicy().invalidateCaches(facade);
|
|
}
|
|
|
|
void CacheManager::invalidateCaches(FacadeInternal& facade, const CacheInvalidationPolicy& cacheInvalidationPolicy)
|
|
{
|
|
cacheInvalidationPolicy.invalidateCaches(facade);
|
|
}
|
|
|
|
bool CacheManager::isCacheValid(FacadeInternal& facade, CacheUnit cacheUnit)
|
|
{
|
|
switch(cacheUnit)
|
|
{
|
|
#if defined(US_MODULE_BATTLEPASS)
|
|
case CacheUnit::Battlepass: return BattlepassProxy::isCacheValid(facade.getBattlepassClient(), cacheUnit);
|
|
case CacheUnit::BattlepassSeason: return BattlepassProxy::isCacheValid(facade.getBattlepassClient(), cacheUnit);
|
|
case CacheUnit::BattlepassSeasonProgression: return BattlepassProxy::isCacheValid(facade.getBattlepassClient(), cacheUnit);
|
|
#endif
|
|
|
|
#if defined(US_MODULE_CLUB)
|
|
case CacheUnit::ClubRewards: return SessionManagerClubProxy::isCacheValid(facade.getManager().getSessionManagerClubRW(), cacheUnit);
|
|
case CacheUnit::ClubBadges: return SessionManagerClubProxy::isCacheValid(facade.getManager().getSessionManagerClubRW(), cacheUnit);
|
|
case CacheUnit::ClubChallengeStatusCommunityCache: return SessionManagerClubProxy::isCacheValid(facade.getManager().getSessionManagerClubRW(), cacheUnit);
|
|
case CacheUnit::ClubChallengeStatusProfileCache: return SessionManagerClubProxy::isCacheValid(facade.getManager().getSessionManagerClubRW(), cacheUnit);
|
|
case CacheUnit::ClubChallengePoolsBundledCache: return SessionManagerClubProxy::isCacheValid(facade.getManager().getSessionManagerClubRW(), cacheUnit);
|
|
case CacheUnit::ClubActions: return SessionManagerClubProxy::isCacheValid(facade.getManager().getSessionManagerClubRW(), cacheUnit);
|
|
#endif
|
|
#if defined(US_MODULE_FRIEND)
|
|
case CacheUnit::Friends: return FriendClientProxy::isFriendCacheValid(facade.getFriendClient());
|
|
#endif
|
|
|
|
#if defined(US_MODULE_PROFILE)
|
|
case CacheUnit::ProfileApplicationUsed: return ProfileProxy::isCacheApplicationUsedValid(facade);
|
|
#endif
|
|
|
|
#if defined(US_MODULE_USER)
|
|
case CacheUnit::LegalOptInsStatus: return UserLegalOptinsStatusProxy::isCacheValid(facade.getUserClient());
|
|
case CacheUnit::UserLocalization: return UserLocalizationProxy::isCacheValid(facade.getUserClient());
|
|
case CacheUnit::UserStatus: return UserStatusProxy::isCacheValid(facade.getUserClient());
|
|
#endif
|
|
|
|
case CacheUnit::ParametersApplication: return ParametersClientProxy::isCacheValid(facade.getParametersClient(), cacheUnit);
|
|
case CacheUnit::ParametersSpace: return ParametersClientProxy::isCacheValid(facade.getParametersClient(), cacheUnit);
|
|
|
|
#if defined(US_PRIMARY_STORE_ENABLED) && (defined(US_TARGET_XONE) || defined(US_TARGET_PS4) || defined(US_TARGET_STADIA) || defined(US_TARGET_PS5))
|
|
case CacheUnit::PrimaryStoreCatalog: return SessionManagerStoreProxy::isCacheValid(facade.getManager().getSessionManagerStoreRW(), cacheUnit);
|
|
case CacheUnit::PrimaryStoreInventory: return SessionManagerStoreProxy::isCacheValid(facade.getManager().getSessionManagerStoreRW(), cacheUnit);
|
|
#endif
|
|
case CacheUnit::ProfilePopulations: return PopulationsProxy::isCachePopulationsValid(facade);
|
|
#if defined(US_MODULE_SSI)
|
|
case CacheUnit::StoreAttributesAll: return StoreAttributesAllProxy::isCacheValid(facade.getSecondaryStoreInstantiationClient());
|
|
case CacheUnit::StoreRulesAll: return StoreRulesAllProxy::isCacheValid(facade.getSecondaryStoreInstantiationClient());
|
|
case CacheUnit::StoreListsOfAttributesAll: return StoreListsOfAttributesAllProxy::isCacheValid(facade.getSecondaryStoreInstantiationClient());
|
|
#endif // US_MODULE_SSI
|
|
#if defined(US_MODULE_NEWS)
|
|
case CacheUnit::NewsProfile: return NewsProxy::isCacheValid(facade.getNewsClient(), cacheUnit);
|
|
case CacheUnit::NewsSpace: return NewsProxy::isCacheValid(facade.getNewsClient(), cacheUnit);
|
|
#endif
|
|
default:
|
|
US_ASSERT(false, "Unknown CacheUnit");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
};
|