mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
[Databuckets] Implement Cache in World
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "../common/shareddb.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/data_verification.h"
|
||||
#include "../common/data_bucket.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "worlddb.h"
|
||||
@@ -135,6 +136,8 @@ Client::Client(EQStreamInterface* ieqs)
|
||||
}
|
||||
|
||||
Client::~Client() {
|
||||
ClearDataBucketsCache();
|
||||
|
||||
if (RunLoops && cle && zone_id == 0)
|
||||
cle->SetOnline(CLE_Status::Offline);
|
||||
|
||||
@@ -477,6 +480,8 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
|
||||
LogClientLogin("Checking authentication id [{}]", id);
|
||||
|
||||
if ((cle = client_list.CheckAuth(id, password))) {
|
||||
LoadDataBucketsCache();
|
||||
|
||||
LogClientLogin("Checking authentication id [{}] passed", id);
|
||||
if (!is_player_zoning) {
|
||||
// Track who is in and who is out of the game
|
||||
@@ -2518,3 +2523,19 @@ void Client::SendUnsupportedClientPacket(const std::string& message)
|
||||
|
||||
QueuePacket(&packet);
|
||||
}
|
||||
|
||||
void Client::LoadDataBucketsCache()
|
||||
{
|
||||
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Account, {GetAccountID()});
|
||||
const auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID());
|
||||
DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Client, ids);
|
||||
}
|
||||
|
||||
void Client::ClearDataBucketsCache()
|
||||
{
|
||||
DataBucket::DeleteFromCache(GetAccountID(), DataBucketLoadType::Account);
|
||||
auto ids = CharacterDataRepository::GetCharacterIDsByAccountID(database, GetAccountID());
|
||||
for (const auto& id : ids) {
|
||||
DataBucket::DeleteFromCache(id, DataBucketLoadType::Client);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,9 @@ private:
|
||||
bool CanTradeFVNoDropItem();
|
||||
void RecordPossibleHack(const std::string& message);
|
||||
void SendUnsupportedClientPacket(const std::string& message);
|
||||
|
||||
void LoadDataBucketsCache();
|
||||
void ClearDataBucketsCache();
|
||||
};
|
||||
|
||||
bool CheckCharCreateInfoSoF(CharCreate_Struct *cc);
|
||||
|
||||
Reference in New Issue
Block a user