private CachedCharacter AddToCache(string charID, CharacterFull character) { var res = new CachedCharacter(character); characters.TryAdd(charID, res); return(res); }
private async Task WriteToDB(CachedCharacter res, string charID) { if (res.dataChanged) { if (!await characterDataSetter.SetCharacterGameData(charID, res.characterGameData)) { Console.WriteLine("ERROR WRITING TO DATABASE"); return; } } if (res.nameChanged) { if (!await characterDataSetter.SetCharacterName(charID, res.CharacterName)) { Console.WriteLine("ERROR WRITING TO DATABASE"); return; } } if (res.visualChanged) { if (!await characterDataSetter.SetCharacterVisualData(charID, res.visualData)) { Console.WriteLine("ERROR WRITING TO DATABASE"); return; } } if (res.valueAccessed && !res.valueChanged) { res.ResetEviction(); } }