From 6ce06da11598b0012297e502759ade43e63d7eaa Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期二, 25 六月 2019 17:00:59 +0800 Subject: [PATCH] 7534 【2.0.100】【后端】日常活动新增蓬莱仙境 --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py index 40691df..7c5686e 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerViewCache.py @@ -29,6 +29,11 @@ import ChConfig import json +import time + +def DoOnDayEx(): + DelOutofTimeViewCacheData() + return def IsSaveDBViewCache(playerID, playerLV): ## 是否保存基本的缓存数据 @@ -57,11 +62,30 @@ return False +def DelOutofTimeViewCacheData(): + ## 删除过期的查看缓存数据 + + curTime = int(time.time()) + MaxTime = 30 * 3600 * 24 # 30天 + + pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager() + playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict + for playerID, viewCache in playerViewCachePyDict.items(): + + passTime = curTime - viewCache.OffTime + if passTime < MaxTime: + continue + if IsSaveAllViewCache(playerID): + continue + playerViewCachePyDict.pop(playerID) + + return + def DeleteViewCache(playerID): ## 删除玩家缓存 pyViewCacheMgr = PyDataManager.GetPlayerViewCachePyManager() playerViewCachePyDict = pyViewCacheMgr.playerViewCachePyDict - playerViewCachePyDict.pop(playerID) + playerViewCachePyDict.pop(playerID, None) GameWorld.DebugLog("删除查看缓存!", playerID) return -- Gitblit v1.8.0