40 lines
853 B
C++
40 lines
853 B
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <a8/timer_attacher.h>
|
|
|
|
#include "ss_proto.pb.h"
|
|
|
|
class CacheMgr : public a8::Singleton<CacheMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_CacheMgr };
|
|
|
|
private:
|
|
CacheMgr() {};
|
|
friend class a8::Singleton<CacheMgr>;
|
|
|
|
public:
|
|
|
|
void Init();
|
|
void UnInit();
|
|
|
|
void _SS_IM_UserOnline(f8::MsgHdr& hdr, const ss::SS_IM_UserOnline& msg);
|
|
void _SS_IM_UserOffline(f8::MsgHdr& hdr, const ss::SS_IM_UserOffline& msg);
|
|
void _SS_IM_PullUserList(f8::MsgHdr& hdr, const ss::SS_IM_PullUserList& msg);
|
|
|
|
Friend* GetFriendData(const std::string& account_id);
|
|
size_t GetCacheFriendNum();
|
|
|
|
private:
|
|
void RemoveTimeoutFriend();
|
|
|
|
private:
|
|
a8::TimerAttacher timer_attacher_;
|
|
|
|
std::map<std::string, Friend*> friend_hash_;
|
|
list_head friend_list_;
|
|
list_head* curr_entry_ = nullptr;
|
|
};
|