Exemple #1
0
        public RedisOutputCacheConnectionWrapper(ProviderConfiguration configuration)
        {
            this.configuration = configuration;

            // Shared connection is created by server when it starts. don't want to lock everytime when check == null.
            // so that is why pool == null exists twice.
            if (sharedConnection == null)
            {
                lock (lockForSharedConnection)
                {
                    if (sharedConnection == null)
                    {
                        sharedConnection = new RedisSharedConnection(configuration, () => new StackExchangeClientConnection(configuration));
                    }
                }
            }
            redisConnection = sharedConnection.TryGetConnection();
        }
        public RedisOutputCacheConnectionWrapper(ProviderConfiguration configuration)
        {
            this.configuration = configuration;

            // only single object of RedisSharedConnection will be created and then reused
            if (sharedConnection == null)
            {
                lock (lockForSharedConnection)
                {
                    if (sharedConnection == null)
                    {
                        sharedConnection = new RedisSharedConnection(configuration);
                        redisUtility     = new RedisUtility(configuration);
                    }
                }
            }
            redisConnection = new StackExchangeClientConnection(configuration, redisUtility, sharedConnection);
        }
 public RedisOutputCacheConnectionWrapper(ProviderConfiguration configuration)
 {
     this.configuration = configuration;
     
     // Shared connection is created by server when it starts. don't want to lock everytime when check == null.
     // so that is why pool == null exists twice.
     if (sharedConnection == null)
     {
         lock (lockForSharedConnection)
         {
             if (sharedConnection == null)
             {
                 sharedConnection = new RedisSharedConnection(configuration,() => new StackExchangeClientConnection(configuration));
             }
         }
     }
     redisConnection = sharedConnection.TryGetConnection();
 }
        public RedisConnectionWrapper(ProviderConfiguration configuration, string id)
        {
            this.configuration = configuration;
            Keys = new KeyGenerator(id, configuration.ApplicationName);

            // only single object of RedisSharedConnection will be created and then reused
            if (sharedConnection == null)
            {
                lock (lockForSharedConnection)
                {
                    if (sharedConnection == null)
                    {
                        sharedConnection = new RedisSharedConnection(configuration);
                        redisUtility     = new RedisUtility(configuration);
                    }
                }
            }
            redisConnection = new StackExchangeClientConnection(configuration, redisUtility, sharedConnection);
        }
Exemple #5
0
        public RedisConnectionWrapper(ProviderConfiguration configuration, string id)
        {
            this.configuration = configuration;
            Keys = new KeyGenerator(id, configuration.ApplicationName);

            // Pool is created by server when it starts. don't want to lock everytime when check pool == null.
            // so that is why pool == null exists twice.
            if (sharedConnection == null)
            {
                lock (lockForSharedConnection)
                {
                    if (sharedConnection == null)
                    {
                        sharedConnection = new RedisSharedConnection(configuration, () => new StackExchangeClientConnection(configuration));
                    }
                }
            }
            redisConnection = sharedConnection.TryGetConnection();
        }
 public RedisConnectionWrapper(ProviderConfiguration configuration, string id)
 {
     this.configuration = configuration;
     Keys = new KeyGenerator(id, configuration.ApplicationName);
     
     // Pool is created by server when it starts. don't want to lock everytime when check pool == null.
     // so that is why pool == null exists twice.
     if (sharedConnection == null)
     {
         lock (lockForSharedConnection)
         {
             if (sharedConnection == null)
             {
                 sharedConnection = new RedisSharedConnection(configuration,() => new StackExchangeClientConnection(configuration));
             }
         }
     }
     redisConnection = sharedConnection.TryGetConnection();
 }
Exemple #7
0
        public RedisObjectCacheConnectionWrapper(ProviderConfiguration configuration, string name)
        {
            this.configuration = configuration;

            // Shared connection is created by server when it starts. don't want to lock everytime when check == null.
            // so that is why pool == null exists twice.
            if (!sharedConnections.ContainsKey(name))
            {
                lock (lockForSharedConnection)
                {
                    if (!sharedConnections.ContainsKey(name))
                    {
                        sharedConnections[name] = new RedisSharedConnection(configuration, () => new StackExchangeClientConnection(configuration));
                        redisUtility            = new RedisUtility(configuration);
                    }
                }
            }
            redisConnection = sharedConnections[name].TryGetConnection();
        }
 public StackExchangeClientConnection(ProviderConfiguration configuration, RedisUtility redisUtility, RedisSharedConnection sharedConnection)
 {
     _configuration    = configuration;
     _redisUtility     = redisUtility;
     _sharedConnection = sharedConnection;
 }