/// <summary> /// delete cache /// </summary> /// <param name="commandInfo"></param> /// <param name="parameters"></param> /// <param name="configItem"></param> private void DeleteCache(CommandInfo commandInfo, ServerConfigItem configItem, object[] parameters) { object[] deleteDatas = null; try { foreach (var cacheDelete in configItem.CacheDeletes) { var deleteCommandConfig = ServerConfig.GetItem(cacheDelete.Server, cacheDelete.Command); if (deleteCommandConfig == null) { this.logManager.Exception(new CsException("Not Find Cache Config {0}.{1} By {2}.{3} Cache Delete" , cacheDelete.Server, cacheDelete.Command , commandInfo.Server, commandInfo.Name )); continue; } else if (null != deleteCommandConfig.CacheVersion) { var version = ServerCache.GetVersion(); //update version ServerCache.Cache.Set(deleteCommandConfig.CacheVersion, version, ServerConfig.GetVersionExpires(commandInfo.Server, deleteCommandConfig.CacheVersion)); if (ServerCache.LogWriter.Enable) { ServerCache.LogWriter.WriteTimeLine("Delete Cache Version: " + deleteCommandConfig.CacheVersion); } } else { //delete deleteDatas = this.GetDeleteParametersDatas(cacheDelete, parameters); var cacheKey = ServerCache.BuildKey(deleteCommandConfig.CacheKey, deleteDatas); ServerCache.Cache.Delete(cacheKey); if (ServerCache.LogWriter.Enable) { ServerCache.LogWriter.WriteTimeLine("Delete Cache: " + cacheKey); } } } } catch (CsException) { throw; } catch (Exception e) { this.logManager.Exception(e); } }
/// <summary> /// delete cache /// </summary> /// <param name="commandInfo"></param> /// <param name="parameters"></param> /// <param name="configItem"></param> private void DeleteCache(CommandInfo commandInfo, ServerConfigItem configItem, object[] parameters) { object[] deleteDatas = null; try { foreach (var cacheDelete in configItem.CacheDeletes) { var deleteCommandConfig = ServerConfig.GetItem(cacheDelete.Server, cacheDelete.Command); if (deleteCommandConfig == null) { this.serverLogger.CommandCacheDelete(commandInfo.Server, commandInfo.Name, cacheDelete.Server, cacheDelete.Command, "Not Find"); continue; } else if (null != deleteCommandConfig.CacheVersion) { var version = ServerCache.GetVersion(); //update version ServerCache.Cache.Set(deleteCommandConfig.CacheVersion, version, ServerConfig.GetVersionExpires(commandInfo.Server, deleteCommandConfig.CacheVersion)); } else { //delete deleteDatas = this.GetDeleteParametersDatas(cacheDelete, parameters); var cacheKey = ServerCache.BuildKey(deleteCommandConfig.CacheKey, deleteDatas); ServerCache.Cache.Delete(cacheKey); } } } catch (CsException) { throw; } catch (Exception e) { this.serverLogger.CommandCacheException(commandInfo.Server, commandInfo.Name, e); } }