Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Membase.MembasePool" /> class 
        /// using a custom configuration provider and the specified bucket name.
        /// </summary>
        /// <param name="configuration">The custom configuration provider.</param>
        /// <param name="bucketName">The name of the bucket this client will connect to. Note: this will override the configuration's BucketName property.</param>
        public MembaseClient(IMembaseClientConfiguration configuration, string bucketName)
            : base(new MembasePool(configuration, IsDefaultBucket(bucketName) ? null : bucketName),
					configuration.CreateKeyTransformer(),
					configuration.CreateTranscoder(),
					configuration.CreatePerformanceMonitor())
        {
        }
Ejemplo n.º 2
0
 protected MembaseClient(IMembaseServerPool pool, IMembaseClientConfiguration configuration)
     : base(pool,
            configuration.CreateKeyTransformer(),
            configuration.CreateTranscoder(),
            configuration.CreatePerformanceMonitor())
 {
     this.poolInstance = (IMembaseServerPool)this.Pool;
 }
Ejemplo n.º 3
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:Enyim.Membase.MembaseClient" /> class 
		/// using a custom configuration provider and the specified bucket name and password.
		/// </summary>
		/// <param name="configuration">The custom configuration provider.</param>
		/// <param name="bucketName">The name of the bucket this memcachedClient will connect to.</param>
		/// <param name="bucketPassword">The password of the bucket this memcachedClient will connect to.</param>
		public MembaseClient(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword) :
			base(new MembasePool(configuration, bucketName, bucketPassword),
					configuration.CreateKeyTransformer(),
					configuration.CreateTranscoder(),
					configuration.CreatePerformanceMonitor())
		{
			this.poolInstance = (MembasePool)this.Pool;
		}
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Membase.MembaseClient" /> class
 /// using a custom configuration provider and the specified bucket name and password.
 /// </summary>
 /// <param name="configuration">The custom configuration provider.</param>
 /// <param name="bucketName">The name of the bucket this client will connect to.</param>
 /// <param name="bucketPassword">The password of the bucket this client will connect to.</param>
 public MembaseClient(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword) :
     base(new MembasePool(configuration, bucketName, bucketPassword),
          configuration.CreateKeyTransformer(),
          configuration.CreateTranscoder(),
          configuration.CreatePerformanceMonitor())
 {
     this.poolInstance = (IMembaseServerPool)this.Pool;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Enyim.Membase.MembasePool" /> class using the specified configuration,
        /// bucket name and password.
        /// </summary>
        /// <param name="configuration">The configuration to be used.</param>
        /// <param name="bucketName">The name of the bucket to connect to. Overrides the configuration's Bucket property.</param>
        /// <param name="bucketPassword">The password to the bucket. Overrides the configuration's BucketPassword property.</param>
        public MembasePool(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.Initialize(configuration, bucketName, bucketPassword);
        }
        public ReadOnlyConfig(IMembaseClientConfiguration original)
        {
            this.bucket         = original.Bucket;
            this.bucketPassword = original.BucketPassword;
            this.urls           = original.Urls.ToArray();

            this.retryCount   = original.RetryCount;
            this.retryTimeout = original.RetryTimeout;

            this.spc = new SPC(original.SocketPool);

            this.original = original;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Membase.MembasePool" /> class using the specified configuration,
        /// bucket name and password.
        /// </summary>
        /// <param name="configuration">The configuration to be used.</param>
        /// <param name="bucket">The name of the bucket to connect to.</param>
        /// <param name="bucketPassword">The password to the bucket.</param>
        /// <remarks> If the password is null, the bucket name will be used. Set to String.Empty to use an empty password.</remarks>
        public MembasePool(IMembaseClientConfiguration configuration, string bucket, string bucketPassword)
        {
            this.configuration = configuration;
            this.bucketName = bucket ?? configuration.Bucket;
            // parameter -> config -> name
            this.bucketPassword = bucketPassword ?? configuration.BucketPassword ?? bucketName;

            // make null both if we use the default bucket since we do not need to be authenticated
            if (String.IsNullOrEmpty(this.bucketName) || this.bucketName == "default")
            {
                this.bucketName = null;
                this.bucketPassword = null;
            }

            this.deadTimeoutMsec = (long)this.configuration.SocketPool.DeadTimeout.TotalMilliseconds;
        }
Ejemplo n.º 8
0
        private void Initialize(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword)
        {
            this.configuration = configuration;

            // make null both if we use the default bucket since we do not need to be authenticated
            if (String.IsNullOrEmpty(bucketName) || bucketName == "default")
            {
                this.bucketName     = null;
                this.bucketPassword = null;
            }
            else
            {
                this.bucketName     = bucketName;
                this.bucketPassword = bucketPassword ?? String.Empty;
            }

            this.deadTimeoutMsec = (long)this.configuration.SocketPool.DeadTimeout.TotalMilliseconds;
        }
Ejemplo n.º 9
0
		private void Initialize(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword)
		{
			this.configuration = configuration;

			// make null both if we use the default bucket since we do not need to be authenticated
			if (String.IsNullOrEmpty(bucketName) || bucketName == "default")
			{
				this.bucketName = null;
				this.bucketPassword = null;
			}
			else
			{
				this.bucketName = bucketName;
				this.bucketPassword = bucketPassword ?? String.Empty;
			}

			this.deadTimeoutMsec = (long)this.configuration.SocketPool.DeadTimeout.TotalMilliseconds;
		}
Ejemplo n.º 10
0
        private void Initialize(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword)
        {
            var roc = new ReadOnlyConfig(configuration);

            // make null both if we use the default bucket since we do not need to be authenticated
            if (String.IsNullOrEmpty(bucketName) || bucketName == "default")
            {
                bucketName     = null;
                bucketPassword = null;
            }
            else
            {
                bucketPassword = bucketPassword ?? String.Empty;
            }

            roc.OverrideBucket(bucketName, bucketPassword);

            this.configuration   = roc;
            this.deadTimeoutMsec = (long)this.configuration.SocketPool.DeadTimeout.TotalMilliseconds;
        }
Ejemplo n.º 11
0
 public MembasePool(IMembaseClientConfiguration configuration, string bucket)
 {
     throw new InvalidOperationException("Use .ctor(config, bucket, password) to explicitly set the bucket password.");
 }
        public ReadOnlyConfig(IMembaseClientConfiguration original)
        {
            this.bucket = original.Bucket;
            this.bucketPassword = original.BucketPassword;
            this.urls = original.Urls.ToArray();

            this.retryCount = original.RetryCount;
            this.retryTimeout = original.RetryTimeout;

            this.spc = new SPC(original.SocketPool);

            this.original = original;
        }
Ejemplo n.º 13
0
		public MembasePool(IMembaseClientConfiguration configuration, string bucket)
		{
			throw new InvalidOperationException("Use .ctor(config, bucket, password) to explicitly set the bucket password.");
		}
Ejemplo n.º 14
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:Enyim.Membase.MembasePool" /> class using the specified configuration,
		/// bucket name and password.
		/// </summary>
		/// <param name="configuration">The configuration to be used.</param>
		/// <param name="bucketName">The name of the bucket to connect to. Overrides the configuration's Bucket property.</param>
		/// <param name="bucketPassword">The password to the bucket. Overrides the configuration's BucketPassword property.</param>
		public MembasePool(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword)
		{
			if (configuration == null) throw new ArgumentNullException("configuration");

			this.Initialize(configuration, bucketName, bucketPassword);
		}
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Membase.MembasePool" /> class using the specified configuration 
 /// and bucket name. The name also will be used as the bucket password.
 /// </summary>
 /// <param name="configuration">The configuration to be used.</param>
 /// <param name="bucket">The name of the bucket to connect to.</param>
 public MembasePool(IMembaseClientConfiguration configuration, string bucket)
     : this(configuration, bucket, null)
 {
 }
        /// <summary>
        /// Reads the config for the membase client.
        /// </summary>
        /// <returns>The config section</returns>
        private static IMembaseClientConfiguration ReadConfig()
        {
            var config = ConfigurationManager.GetSection("membase") as IMembaseClientConfiguration;
            if (config != null)
            {
                return config;
            }

            if (log.IsInfoEnabled)
            {
                log.Info("membase configuration section not found, using default pool http://localhost:8091/pools/default.");
            }

            config = new MembaseClientConfiguration();
            config.Urls.Add(new Uri("http://localhost:8091/pools/default"));
            return config;
        }
Ejemplo n.º 17
0
        private void Initialize(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword)
        {
            var roc = new ReadOnlyConfig(configuration);

            // make null both if we use the default bucket since we do not need to be authenticated
            if (String.IsNullOrEmpty(bucketName) || bucketName == "default")
            {
                bucketName = null;
                bucketPassword = null;
            }
            else
            {
                bucketPassword = bucketPassword ?? String.Empty;
            }

            roc.OverrideBucket(bucketName, bucketPassword);

            this.configuration = roc;
            this.deadTimeoutMsec = (long)this.configuration.SocketPool.DeadTimeout.TotalMilliseconds;
        }
Ejemplo n.º 18
0
 public MembasePool(IMembaseClientConfiguration configuration)
     : this(configuration, null)
 {
 }
 public MembaseClientWrapper(IMembaseClientConfiguration config, string bucketName)
 {
     this.nsc = new MembaseClient(config, bucketName);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Membase.MembaseClient" /> class using a custom configuration provider.
 /// </summary>
 /// <param name="configuration">The custom configuration provider.</param>
 public MembaseClient(IMembaseClientConfiguration configuration) :
     this(configuration, configuration.Bucket, configuration.BucketPassword)
 {
 }
Ejemplo n.º 21
0
 //public MembaseClientWrapper(IMembaseClientConfiguration config) : this(config, config.Bucket, config.BucketPassword) { }
 public MembaseClientWrapper(IMembaseClientConfiguration config, string bucketName, string bucketPassword)
     : base(new MembaseClient(config, bucketName, bucketPassword))
 {
 }
Ejemplo n.º 22
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:Enyim.Membase.MembaseClient" /> class using a custom configuration provider.
		/// </summary>
		/// <param name="configuration">The custom configuration provider.</param>
		public MembaseClient(IMembaseClientConfiguration configuration) :
			this(configuration, configuration.Bucket, configuration.BucketPassword) { }
Ejemplo n.º 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Membase.MembaseClient" /> class
 /// using a custom configuration provider and the specified bucket name and password.
 /// </summary>
 /// <param name="configuration">The custom configuration provider.</param>
 /// <param name="bucketName">The name of the bucket this client will connect to.</param>
 /// <param name="bucketPassword">The password of the bucket this client will connect to.</param>
 public MembaseClient(IMembaseClientConfiguration configuration, string bucketName, string bucketPassword) :
     this(new MembasePool(configuration, bucketName, bucketPassword), configuration)
 {
 }
 public MembaseClientWrapper(IMembaseClientConfiguration config)
     : this(config, null)
 {
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Membase.MembasePool" /> class 
 /// using a custom configuration provider.
 /// </summary>
 /// <param name="configuration">The custom configuration provider.</param>
 public MembaseClient(IMembaseClientConfiguration configuration)
     : this(configuration, null)
 {
     this.nsPool = (MembasePool)this.Pool;
 }