Example #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();
        }
Example #2
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();
        }