Skip to content

Commit 3c33955

Browse files
Adjust caches documentation
* Fix typos * Remove obsolete stuff * Add a note on caches potentially shared between session factories * Link each cache to its configuration documentation * Give ids to all sections * Switch Memcache for EnyimMemcached and document it. The former is no more maintained since years, and its NuGet package is not updated. Moreover it fails some basic tests. The later appears to be no more maintained since one year and a half, but it does not fail tests and its NuGet package is still updated.
1 parent ebea8e4 commit 3c33955

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

doc/reference/modules/nhibernate_caches.xml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<title>NHibernate.Caches namespace contains several second-level cache providers for NHibernate.</title>
1010

1111
<para>
12-
A cache is place where entities are kept after being loaded from the database; once cached, they can be
12+
A cache is a place where entities are kept after being loaded from the database; once cached, they can be
1313
retrieved without going to the database. This means that they are faster to (re)load.
1414
</para>
1515

@@ -35,6 +35,12 @@
3535
the same entity without hitting the database each time; hence the performance gain.
3636
</para>
3737

38+
<para>
39+
Depending on the chosen cache provider, the second level cache may be actually shared between different session
40+
factories. If you need to avoid this for some session factories, configure each of them with a different
41+
<literal>cache.region_prefix</literal>. See <xref linkend="configuration-optional" />.
42+
</para>
43+
3844
<para>
3945
Several cache providers have been contributed by NHibernate users:
4046
<variablelist>
@@ -45,6 +51,7 @@
4551
Uses <classname>Bamboo.Prevalence</classname> as the cache provider. Open the
4652
file <filename>Bamboo.Prevalence.license.txt</filename> for more information about its license;
4753
you can also visit its <ulink url="http://bbooprevalence.sourceforge.net/">website</ulink>.
54+
Also see <xref linkend="NHibernate.Caches.Prevalence" />.
4855
</para>
4956
</listitem>
5057
</varlistentry>
@@ -55,6 +62,7 @@
5562
Uses <classname>System.Web.Caching.Cache</classname> as the cache provider. This means that you can
5663
rely on ASP.NET caching feature to understand how it works. For more information, read (on the MSDN):
5764
<ulink url="https://msdn.microsoft.com/en-us/library/6hbbsfk6.aspx">Caching Application Data</ulink>.
65+
Also see <xref linkend="NHibernate.Caches.SysCache" />.
5866
</para>
5967
</listitem>
6068
</varlistentry>
@@ -69,14 +77,17 @@
6977
<para>
7078
SysCache2 requires Microsoft SQL Server 2000 or higher.
7179
</para>
80+
<para>
81+
See <xref linkend="NHibernate.Caches.SysCache2" />.
82+
</para>
7283
</listitem>
7384
</varlistentry>
7485
<varlistentry>
75-
<term><classname>NHibernate.Caches.MemCache</classname></term>
86+
<term><classname>NHibernate.Caches.EnyimMemcached</classname></term>
7687
<listitem>
7788
<para>
78-
Uses <literal>memcached</literal>. See <ulink url="https://memcached.org/">memcached homepage</ulink>
79-
for more information.
89+
Uses <literal>Memcached</literal>. See <ulink url="https://memcached.org/">memcached homepage</ulink>
90+
for more information on Memcached. Also see <xref linkend="NHibernate.Caches.EnyimMemcached" />.
8091
</para>
8192
</listitem>
8293
</varlistentry>
@@ -96,6 +107,7 @@
96107
<listitem>
97108
<para>
98109
Uses <classname>System.Runtime.Caching.MemoryCache.Default</classname> as the cache provider.
110+
See <xref linkend="NHibernate.Caches.RtMemoryCache" />.
99111
</para>
100112
</listitem>
101113
</varlistentry>
@@ -111,17 +123,16 @@
111123
<itemizedlist>
112124
<listitem>
113125
<para>
114-
Choose the cache provider you want to use and copy its assembly in your assemblies directory
115-
(<filename>NHibernate.Caches.Prevalence.dll</filename> or
116-
<filename>NHibernate.Caches.SysCache.dll</filename>).
126+
Choose the cache provider you want to use and copy its assembly in your assemblies directory.
127+
(For example, <filename>NHibernate.Caches.Prevalence.dll</filename> or
128+
<filename>NHibernate.Caches.SysCache.dll</filename>.)
117129
</para>
118130
</listitem>
119131
<listitem>
120132
<para>
121133
To tell NHibernate which cache provider to use, add in your NHibernate configuration file
122134
(can be <filename>YourAssembly.exe.config</filename> or <filename>web.config</filename> or a
123-
<filename>.cfg.xml</filename> file, in the latter case the syntax will be different from what
124-
is shown below):
135+
<filename>.cfg.xml</filename> file):
125136
<programlisting>
126137
&lt;property name="cache.provider_class"&gt;<literal>XXX</literal>&lt;/property&gt;<co id="hibernate.cache.provider_class-co" linkends="hibernate.cache.provider_class"/>
127138
&lt;property name="cache.default_expiration"&gt;<literal>120</literal>&lt;/property&gt;<co id="nhcaches-expiration-co" linkends="nhcaches-expiration"/>
@@ -312,7 +323,7 @@
312323
</configSections>]]></programlisting>
313324
</example>
314325

315-
<section>
326+
<section id="NHibernate.Caches.SysCache2-Table">
316327
<title>Table-based Dependency</title>
317328

318329
<para>
@@ -369,7 +380,7 @@
369380
</varlistentry>
370381
</variablelist>
371382

372-
<section>
383+
<section id="NHibernate.Caches.SysCache2-Command">
373384
<title>Command-Based Dependencies</title>
374385

375386
<para>
@@ -464,7 +475,7 @@
464475
</variablelist>
465476
</section>
466477

467-
<section>
478+
<section id="NHibernate.Caches.SysCache2-Aggregate">
468479
<title>Aggregate Dependencies</title>
469480

470481
<para>
@@ -508,7 +519,7 @@
508519
</example>
509520
</section>
510521

511-
<section>
522+
<section id="NHibernate.Caches.SysCache2-AdditionalSettings">
512523
<title>Additional Settings</title>
513524
<para>
514525
In addition to data dependencies for the cache regions, time based expiration policies can be specified
@@ -571,7 +582,15 @@
571582
</varlistentry>
572583
</variablelist>
573584
</section>
585+
</section>
574586

587+
<section id="NHibernate.Caches.EnyimMemcached">
588+
<title>EnyimMemcached Configuration</title>
589+
<para>
590+
Its configuration relies on the EnyimMemcached library own configuration, through its
591+
<literal>enyim.com/memcached</literal> configuration section. See
592+
<ulink url="https://github.com/enyim/EnyimMemcached">project site</ulink>.
593+
</para>
575594
</section>
576595

577596
<section id="NHibernate.Caches.RtMemoryCache">

0 commit comments

Comments
 (0)