/
NulltprVibe
/
PlayerProfileManager
Обзор
Документация
Войти
/
NulltprVibe
/
PlayerProfileManager
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
PlayerProfileManagerImpl.cpp
35 строк
998 B
NullptrVibe
PlayerProfileManagerImpl.cpp
11 янв 2026, 23:54
11 янв 2026, 23:54
0524f0c
Код
Авторство
О чём код?
#include "PlayerProfileManager.h" #include "player_service.pb.h" class PlayerProfileManagerImpl : public PlayerProfileManager { public: player_service::PlayerProfile GetProfile(const player_service::GetProfileRequest &request) override { uint64_t id = request.player_id(); player_service::PlayerProfile profile; if (CheckInCache(id, &profile)) { return profile; } profile = LoadFromDatabase(id); SaveToCache(id, profile); return profile; } private: bool CheckInCache(uint64_t id, player_service::PlayerProfile *out_profile) { return false; // Пока имитируем, что в кэше пусто } player_service::PlayerProfile LoadFromDatabase(uint64_t id) { // Здесь SQL запрос player_service::PlayerProfile p; p.set_player_id(id); p.set_nickname("NewPlayer"); return p; } void SaveToCache(uint64_t id, const player_service::PlayerProfile &p) { // Здесь код записи в Redis } };