DragonNest/Server/ServerCommon/MasterSystemCacheRepository.h
2024-12-20 16:56:44 +08:00

107 lines
9.2 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.


#pragma once
class CDNUserSession;
namespace MasterSystem
{
const DWORD CACHETICK = (1000*30); // 30УЪ
const DWORD CACHECLEARTICK = (1000*60*10); // 10Ка
class CCacheRepository:public CSingleton<CCacheRepository>
{
public:
CCacheRepository():m_dwCacheTick(0),m_uiCacheClearCount(0)
{
}
void GetMasterList( CDNUserSession* pSession, UINT uiPage, BYTE cJob, BYTE cGender );
void SetMasterList( CDNUserSession* pSession, TAGetPageMasterCharacter* pData );
void GetMasterCharacter( CDNUserSession* pSession, INT64 biCharacterDBID );
void SetMasterCharacter( CDNUserSession* pSession, TAGetMasterCharacterType1* pData );
void GetMyMasterInfo( CDNUserSession* pSession, INT64 biPupilCharacterDBID, INT64 biMasterCharacterDBID, bool bRefresh );
void SetMyMasterInto( CDNUserSession* pSession, TAGetMasterCharacterType2* pData );
const TPupilInfo* GetPupilInfo( INT64 biMasterCharacterDBID, INT64 biPupilCharacterDBID );
void GetPupilList( CDNUserSession* pSession, INT64 biCharacterDBID, bool bRefresh );
void SetPupilList( CDNUserSession* pSession, TAGetListPupil* pData );
void GetMasterClassmateList( CDNUserSession* pSession, INT64 biCharacterDBID, bool bRefresh );
void SetMasterClassmateList( CDNUserSession* pSession, TAGetListMyMasterAndClassmate* pData );
void GetClassmateInfo( CDNUserSession* pSession, INT64 biClassmateCharacterDBID, bool bRefresh );
void SetClassmateInfo( CDNUserSession* pSession, TAGetMyClassmate* pData );
TCommunityLocation GetLocationInfo( INT64 biCharacterDBID );
void SetRegisterMaster( CDNUserSession* pSession, TAAddMasterCharacter* pData );
void SetRegisterMaster( CDNUserSession* pSession, TADelMasterCharacter* pData );
void ClearCache();
private:
CSyncLock m_Sync;
DWORD m_dwCacheTick;
UINT m_uiCacheClearCount;
//#####################################################################################
// [0]MasterList
//#####################################################################################
// Key:<Page,Job,Gender> : Value:<Tick,Data>
//#####################################################################################
typedef std::map< std::tr1::tuple<UINT,BYTE,BYTE>, std::pair<DWORD,std::vector<TMasterInfo>> > MMasterList;
typedef MMasterList::iterator MMasterListItor;
MMasterList m_mMasterList;
//#####################################################################################
// [1]PupilList
//#####################################################################################
// Key:MasterCharacterDBID : value:<Tick,Data>
//#####################################################################################
typedef std::map< INT64, std::pair<DWORD,std::vector<TPupilInfo>> > MPupilList;
typedef MPupilList::iterator MPupilListItor;
MPupilList m_mPupilList;
//#####################################################################################
// [2]Master&Classmate List
//#####################################################################################
// Key:PupilCharacterDBID : value:<Tick,Data>
//#####################################################################################
typedef std::map< INT64, std::pair<DWORD,std::vector<TMasterAndClassmateInfo>> > MMasterClassmateList;
typedef MMasterClassmateList::iterator MMasterClassmateListItor;
MMasterClassmateList m_mMasterClassmateList;
//#####################################################################################
// [3]ClassmateInfo
//#####################################################################################
// Key:CharacterDBID : value:<Tick,Data>
//#####################################################################################
typedef std::map< INT64, std::pair<DWORD,TClassmateInfo> > MClassmateInfoList;
typedef MClassmateInfoList::iterator MClassmateInfoListItor;
MClassmateInfoList m_mClassmateList;
//#####################################################################################
// [4]MyMasterInfo
//#####################################################################################
// Key:<PupilCharacterDBID,MasterCharacterDBID> : value:<Tick,Data>
//#####################################################################################
typedef std::map< std::pair<INT64,INT64>, std::pair<DWORD,TMyMasterInfo> > MMyMasterInfoList;
typedef MMyMasterInfoList::iterator MMyMasterInfoListItor;
MMyMasterInfoList m_mMyMasterList;
};
}