示例#1
0
        protected CouchbaseClient(ICouchbaseServerPool pool, ICouchbaseClientConfiguration configuration)
            : base(pool,
                   configuration.CreateKeyTransformer(),
                   configuration.CreateTranscoder(),
                   configuration.CreatePerformanceMonitor())
        {
            this.documentNameTransformer = configuration.CreateDesignDocumentNameTransformer();
            this.poolInstance            = (ICouchbaseServerPool)this.Pool;
            observeTimeout = configuration.ObserveTimeout;

            StoreOperationResultFactory  = new DefaultStoreOperationResultFactory();
            GetOperationResultFactory    = new DefaultGetOperationResultFactory();
            MutateOperationResultFactory = new DefaultMutateOperationResultFactory();
            ConcatOperationResultFactory = new DefaultConcatOperationResultFactory();
            RemoveOperationResultFactory = new DefaultRemoveOperationResultFactory();
        }
示例#2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:MemcachedClient"/> using the specified configuration instance.
		/// </summary>
		/// <param name="configuration">The client configuration.</param>
		public MemcachedClient(IMemcachedClientConfiguration configuration)
		{
			if (configuration == null)
				throw new ArgumentNullException("configuration");

			this.keyTransformer = configuration.CreateKeyTransformer() ?? new DefaultKeyTransformer();
			this.transcoder = configuration.CreateTranscoder() ?? new DefaultTranscoder();
			this.performanceMonitor = configuration.CreatePerformanceMonitor();

			this.pool = configuration.CreatePool();
			this.pool.NodeFailed += (n) => { var f = this.NodeFailed; if (f != null) f(n); };
			this.StartPool();

			StoreOperationResultFactory = new DefaultStoreOperationResultFactory();
			GetOperationResultFactory = new DefaultGetOperationResultFactory();
			MutateOperationResultFactory = new DefaultMutateOperationResultFactory();
			ConcatOperationResultFactory = new DefaultConcatOperationResultFactory();
			RemoveOperationResultFactory = new DefaultRemoveOperationResultFactory();
		}