public byte[] FetchSharedBytes(int count) { var redisKeyIdentifier = GenerateRedisKey(count); // Todo: Somehow rotate the key better. var keyBytes = Encoding.ASCII.GetString(GenerateRandomBytes(count)); if (!_redis.SetRawValue(RedisDBKeyTypes.FreeconCsrfKey, redisKeyIdentifier, keyBytes, null, SetWhen.NotExists)) { keyBytes = _redis.GetRawValue(RedisDBKeyTypes.FreeconCsrfKey, redisKeyIdentifier); } _cachedKeys[count] = Encoding.ASCII.GetBytes(keyBytes); _timeOfLastFetchLookup[count] = DateTime.Now; return(_cachedKeys[count]); }