-
-
Save rejwan/48ae36bc57b5a2deae32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<Player> GetPlayerBySecretKey(string secretKey) | |
{ | |
if (!ConfigurationManager.IsCacheEnabled || string.IsNullOrEmpty(secretKey)) | |
{ | |
return null; | |
} | |
try | |
{ | |
ICacheClient redis = _redisPool.GetCacheClient(); | |
using (redis) | |
{ | |
var player = await Task.Run(() => redis.Get<Player>(GetFormattedPlayerId(secretKey))); | |
if (player != null) | |
{ | |
player.IsTrackingChanges = true; | |
} | |
return player; | |
} | |
} | |
catch (Exception exception) | |
{ | |
DebugAccess.WriteDebug(exception, "REDIS GET FAIL"); | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment