Ejemplo n.º 1
0
 private static void ValidateRedisAttribute(RedisAttribute attribute, Type parameterType)
 {
     if (string.IsNullOrEmpty(attribute.Configuration))
     {
         throw new ArgumentException("RedisAttribute.Configuration parameter cannot be null", nameof(attribute));
     }
 }
Ejemplo n.º 2
0
 private IConnectionMultiplexer GetConnectionMultiplexerValueFromAttribute(RedisAttribute attribute)
 {
     if (!_connections.ContainsKey(attribute.Configuration))
     {
         _connections[attribute.Configuration] = ConnectionMultiplexer.Connect(attribute.Configuration);
     }
     return(_connections[attribute.Configuration]);
 }
Ejemplo n.º 3
0
 public RedisAsyncCollector(RedisAttribute attribute)
 {
     _key          = attribute.Key;
     _lazyDatabase = new Lazy <Task <IDatabase> >(async() =>
     {
         var connectionMultiplexer = await ConnectionMultiplexer
                                     .ConnectAsync(attribute.Configuration)
                                     .ConfigureAwait(false);
         return(connectionMultiplexer.GetDatabase());
     });
 }
Ejemplo n.º 4
0
        private string GetStringValueFromAttribute(RedisAttribute attribute)
        {
            var connectionMultiplexer = GetConnectionMultiplexerValueFromAttribute(attribute);

            return(connectionMultiplexer.GetDatabase().StringGet(attribute.Key));
        }
Ejemplo n.º 5
0
        private IDatabase GetDatabaseValueFromAttribute(RedisAttribute attribute)
        {
            var connectionMultiplexer = GetConnectionMultiplexerValueFromAttribute(attribute);

            return(connectionMultiplexer.GetDatabase());
        }