Using the CacheManager component, when configuring Couchbase cache support, because of the configuration section cache handle naming rules requirements do not understand, took a little time to check the source to understand.
Section configuration Sections
<sectiongroupname="couchbaseclients"> < Sectionname="Couchbase" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.netclient" /> </sectiongroup>
Cache node Configuration in CacheManager
<Managers> <Cachename="CacheName" UpdateMode=" up" Enablestatistics="false" enableperformancecounters="false"> <Handlename="Couchbaseclients/couchbase:default" ref="Couchbasehandle" Expirationmode="Absolute" Timeout="50s"/> </Cache> </Managers>
Note:
The Handlename naming convention must meet the couchbaseclientsection corresponding configuration section that can be found through the configuration name, that is, couchbaseclients under couchbase
Bucket name is optional, default defaults
Format is <configKey>:<bucketName>
Source Reference CacheManager.Couchbase.BucketCacheHandle
//We can configure the bucket name by having "<configKey>:<bucketName>" as handle ' s//name VA Luevarnameparts = Configuration. Key.split (New[] { ":" }, stringsplitoptions. Removeemptyentries); Ensure (Nameparts.length > 0,"Handle key is not valid {0}", configuration. Key); This. ConfigurationName = Nameparts[0]; if(Nameparts.length = = 2) { This. bucketname = nameparts[1]; } This. Configuration =Couchbaseconfigurationmanager. GetConfiguration ( This. ConfigurationName); This. bucketconfiguration =Couchbaseconfigurationmanager. Getbucketconfiguration ( This. Configuration, This. Bucketname); This. Bucket =Couchbaseconfigurationmanager. Getbucket ( This. Configuration, This. ConfigurationName, This. bucketname);
Couchbase configuration based on the CacheManager component