Skip to content

Commit 5fbd1f3

Browse files
committed
Merge pull request couchbaselabs#18 from couchbaselabs/update-readme2
Update README.md for beta3
2 parents 1bb290d + 12a34cf commit 5fbd1f3

File tree

1 file changed

+66
-53
lines changed

1 file changed

+66
-53
lines changed

README.md

Lines changed: 66 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
1-
couchbase-aspnet 2.0
1+
Couchbase ASP.NET Integration
22
================
33

44
This library provides infrastructure support for using [Couchbase Server](http://couchbase.com) and ASP.NET.
55

6+
- To request a feature or report a bug use [Jira](https://issues.couchbase.com/projects/CBASP).
7+
- Gitter home is here: [![Gitter](https://badges.gitter.im/couchbaselabs/couchbase-aspnet.svg)](https://gitter.im/couchbaselabs/couchbase-aspnet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
8+
- Couchbase Forums for help is [here](https://forums.couchbase.com/c/net-sdk).
9+
610
## Features:
711

812
ASP.NET SessionState Provider
913

10-
* Updated to Couchbase .NET SDK 2.1!
14+
* Updated to Couchbase .NET SDK 2.2!
1115
* Port of the [Enyim Memcached Provider](https://github.com/enyim/memcached-providers) to Couchbase Server
1216

1317
## Requirements
1418

1519
* You'll need .NET Framework 4.5 or later to use the precompiled binaries.
1620
* To build the client, you'll need Visual Studio > 2012 with MVC 4 to compile.
17-
* The Nuget package for [Couchbase.NetClient 2.1.X](http://nuget.org/packages/CouchbaseNetClient) is referenced by Couchbase.AspNet
21+
* The Nuget package for [Couchbase.NetClient 2.2.X](http://nuget.org/packages/CouchbaseNetClient) is referenced by Couchbase.AspNet
1822
* Couchbase Server 2.5 or greater
1923

2024
## Application Startup
2125

22-
The first thing you will need to do is make sure you initialize the Couchbase Cluster using the ClusterHelper class in your Global.asax file:
23-
24-
protected void Application_Start()
25-
{
26-
ClusterHelper.Initialize("couchbase-caching");
27-
28-
...
29-
}
26+
***Note: its no longer required to initialize the ClusterHelper in global.asax or setup.cs to use the session or caching providers***
3027

3128
## Configuring the SessionState provider
3229

30+
Configure the Couchbase Client as you normally would:
31+
32+
<configSections>
33+
<section name="couchbase-session" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
34+
</configSections>
35+
36+
...
37+
38+
<couchbase-session>
39+
<servers>
40+
<!-- changes in appSettings section should also be reflected here -->
41+
<add uri="http://localhost:8091/"></add>
42+
</servers>
43+
<buckets>
44+
<add name="my-memcached-bucket"></add>
45+
</buckets>
46+
</couchbase-session>
47+
3348
Update the sessionState section in Web.config as follows:
3449

35-
<sessionState customProvider="Couchbase" mode="Custom">
50+
<sessionState customProvider="couchbase-session" mode="Custom">
3651
<providers>
37-
<add name="Couchbase" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" />
52+
<add name="couchbase-session" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" bucket="my-memcached-bucket"
53+
maxRetryCount="6" />
3854
</providers>
3955
</sessionState>
4056
41-
Configure the Couchbase Client as you normally would:
57+
**Important #1:** note that the name of the session provider ("couchbase-session") must match the name of the `CouchbaseClientSection` you defined earlier. The name can be anything you like but it must match so that the provider can lookup the couchbase configuration.
4258

43-
<section name="couchbase-caching" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
44-
<couchbase-caching>
45-
<servers>
46-
<add uri="http://localhost:8091"></add>
47-
</servers>
48-
<buckets>
49-
<add name="default"></add>
50-
</buckets>
51-
</couchbase-caching>
59+
**Important #2:** the name of the bucket in the `sessionState` section ("my-memcached-bucket") must match the bucket name defined in the `CouchbaseClientSection `as well so during initialization the correct bucket is created.
5260

5361
If you would like to use a different bucket than the default one, you may do so by specifying a value for the "bucket" attribute of the provider entry (see below).
5462

@@ -60,25 +68,17 @@ If you would like to use a different bucket than the default one, you may do so
6068

6169
If you would like to control the prefixes used to store data in the Couchbase bucket, you can change the default values (which are based on the application name and virtual path) with your own custom values. This will allow you to share session data between applications if you so desire.
6270

63-
<sessionState customProvider="Couchbase" mode="Custom">
64-
<providers>
65-
<add name="Couchbase" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" headerPrefix="header-" dataPrefix ="data-" />
66-
</providers>
67-
</sessionState>
68-
69-
If you would like to use a custom bucket factory, you may do so by specifying a value in the "factory" attribute of the provider entry. The example below sets it to the default factory, but you can replace this with your own factory class to have full control over the creation and lifecycle of the Couchbase client.
70-
71-
<sessionState customProvider="Couchbase" mode="Custom">
71+
<sessionState customProvider="couchbase-session" mode="Custom">
7272
<providers>
73-
<add name="Couchbase" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" factory="Couchbase.AspNet.CouchbaseBucketFactory" />
73+
<add name="couchbase-session" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" headerPrefix="header-" dataPrefix ="data-" />
7474
</providers>
7575
</sessionState>
7676

7777
This session handler also supports the ability to disable exclusive session access for ASP.NET sessions if desired. You can set the value using the "exclusiveAccess" attribute of the provider entry.
7878

79-
<sessionState customProvider="Couchbase" mode="Custom">
79+
<sessionState customProvider="couchbase-session" mode="Custom">
8080
<providers>
81-
<add name="Couchbase" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" exclusiveAccess="false" />
81+
<add name="couchbase-session" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" exclusiveAccess="false" />
8282
</providers>
8383
</sessionState>
8484

@@ -98,47 +98,48 @@ Be sure to mark any user defined types as Serializable.
9898

9999
## Configuring the OutputCache provider
100100

101-
Update the outputCache section in Web.config as follows:
101+
Configure the Couchbase Client as you normally would:
102102

103-
<outputCache defaultProvider="CouchbaseCache">
104-
<providers>
105-
<add name="CouchbaseCache" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" />
106-
</providers>
107-
</outputCache>
103+
<configSections>
104+
<section name="couchbase-caching" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
105+
</configSections>
108106

109-
Configure the Couchbase Client as you normally would:
107+
...
110108

111-
<section name="couchbase-caching" type="Couchbase.Configuration.Client.Providers.CouchbaseClientSection, Couchbase.NetClient" />
112109
<couchbase-caching>
113110
<servers>
114111
<add uri="http://localhost:8091"></add>
115112
</servers>
116113
<buckets>
117-
<add name="default"></add>
114+
<add name="my-couchbase-bucket"></add>
118115
</buckets>
119116
</couchbase-caching>
120117

121-
If you would like to use a different bucket than the default one, you may do so by specifying a value for the "bucket" attribute of the provider entry (see below).
118+
Update the outputCache section in Web.config as follows:
122119

123-
<outputCache defaultProvider="CouchbaseCache">
120+
<outputCache defaultProvider="couchbase-caching">
124121
<providers>
125-
<add name="CouchbaseCache" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" bucket="my-bucket" />
122+
<add name="couchbase-caching" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" bucket="my-couchbase-bucket"/>
126123
</providers>
127124
</outputCache>
128125

129-
If you would like to control the prefix used to store data in the Couchbase bucket, you can change the default values (which are based on the application name and virtual path) with your own custom value. This will allow you to share cache data between applications if you so desire.
126+
**Important #1:** note that the name of the caching provider ("couchbase-caching") must match the name of the `CouchbaseClientSection` you defined earlier. The name can be anything you like but it must match so that the provider can lookup the couchbase configuration.
127+
128+
**Important #2:** the name of the bucket in the `outputCache` section ("my-couchbase-bucket") must match the bucket name defined in the `CouchbaseClientSection `as well so during initialization the correct bucket is created.
130129

131-
<outputCache defaultProvider="CouchbaseCache">
130+
If you would like to use a different bucket than the default one, you may do so by specifying a value for the "bucket" attribute of the provider entry (see below).
131+
132+
<outputCache defaultProvider="couchbase-caching">
132133
<providers>
133-
<add name="CouchbaseCache" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" prefix="cache-" />
134+
<add name="couchbase-caching" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" bucket="my-bucket" />
134135
</providers>
135136
</outputCache>
136137

137-
If you would like to use a custom bucket factory, you may do so by specifying a value in the "factory" attribute of the provider entry. The example below sets it to the default factory, but you can replace this with your own factory class to have full control over the creation and lifecycle of the Couchbase client.
138+
If you would like to control the prefix used to store data in the Couchbase bucket, you can change the default values (which are based on the application name and virtual path) with your own custom value. This will allow you to share cache data between applications if you so desire.
138139

139-
<outputCache defaultProvider="CouchbaseCache">
140+
<outputCache defaultProvider="couchbase-caching">
140141
<providers>
141-
<add name="CouchbaseCache" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" factory="Couchbase.AspNet.CouchbaseBucketFactory" />
142+
<add name="couchbase-caching" type="Couchbase.AspNet.OutputCache.CouchbaseOutputCacheProvider, Couchbase.AspNet" prefix="cache-" />
142143
</providers>
143144
</outputCache>
144145

@@ -157,3 +158,15 @@ or with ASP.NET WebForms
157158
## Packaging Notes
158159
From the Couchbase.AspNet directory, run nuget pack as follows:
159160
`nuget pack .\Couchbase.AspNet.csproj`
161+
162+
163+
##Change Log and Notes##
164+
- `ICouchbaseBucketFactory` and `CouchbaseBucketFactory` have been made obsolete and are no longer used. Instead the provider will use the `CouchbaseConfigSection` as a factory to create the correct cluster and bucket objects.
165+
- `ClusterHelper` is no longer used internally; the provider will create static `Cluster` and `CouchbaseBucket/MemcachedBucket` objects.
166+
- A new parameter has been added to limit the number of retries that will occur if an `CouchbaseSessionStateProvider` item is locked with CAS. It's called `maxRetryCount` and defaults to `5`:
167+
168+
169+
<add name="couchbase-session" type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" maxRetryCount="10" />
170+
171+
##Contributing##
172+
The Couchbase Caching and Session Providers is an open source software project which is depends upon community contributions and feedback. We welcome all forms of contribution good, bad or in-different!

0 commit comments

Comments
 (0)