1
- using System ;
2
1
using System . Xml ;
2
+ using log4net ;
3
3
4
4
namespace NHibernate . Cache
5
5
{
@@ -8,15 +8,18 @@ namespace NHibernate.Cache
8
8
/// </summary>
9
9
public class CacheFactory
10
10
{
11
- private static readonly log4net . ILog log = log4net . LogManager . GetLogger ( typeof ( CacheFactory ) ) ;
11
+ private static readonly ILog log = LogManager . GetLogger ( typeof ( CacheFactory ) ) ;
12
12
13
13
private CacheFactory ( )
14
14
{
15
15
// not publically creatable
16
16
}
17
17
18
+ /// <summary></summary>
18
19
public const string ReadOnly = "read-only" ;
20
+ /// <summary></summary>
19
21
public const string ReadWrite = "read-write" ;
22
+ /// <summary></summary>
20
23
public const string NonstrictReadWrite = "nonstrict-read-write" ;
21
24
22
25
/// <summary>
@@ -26,11 +29,11 @@ private CacheFactory()
26
29
/// <param name="name">The name of the class the strategy is being created for.</param>
27
30
/// <param name="mutable"><c>true</c> if the object being stored in the cache is mutable.</param>
28
31
/// <returns>An <see cref="ICacheConcurrencyStrategy"/> to use for this object in the <see cref="ICache"/>.</returns>
29
- public static ICacheConcurrencyStrategy CreateCache ( XmlNode node , string name , bool mutable )
32
+ public static ICacheConcurrencyStrategy CreateCache ( XmlNode node , string name , bool mutable )
30
33
{
31
- return CacheFactory . CreateCache ( node . Attributes [ "usage" ] . Value , name , mutable ) ;
34
+ return CacheFactory . CreateCache ( node . Attributes [ "usage" ] . Value , name , mutable ) ;
32
35
}
33
-
36
+
34
37
/// <summary>
35
38
/// Creates an <see cref="ICacheConcurrencyStrategy"/> from the parameters.
36
39
/// </summary>
@@ -39,36 +42,36 @@ public static ICacheConcurrencyStrategy CreateCache(XmlNode node, string name, b
39
42
/// <param name="mutable"><c>true</c> if the object being stored in the cache is mutable.</param>
40
43
/// <returns>An <see cref="ICacheConcurrencyStrategy"/> to use for this object in the <see cref="ICache"/>.</returns>
41
44
// was private in h2.1
42
- public static ICacheConcurrencyStrategy CreateCache ( string usage , string name , bool mutable )
45
+ public static ICacheConcurrencyStrategy CreateCache ( string usage , string name , bool mutable )
43
46
{
44
- if ( log . IsDebugEnabled )
47
+ if ( log . IsDebugEnabled )
45
48
{
46
49
log . Debug ( "cache for: " + name + "usage strategy: " + usage ) ;
47
50
}
48
-
51
+
49
52
ICacheConcurrencyStrategy ccs = null ;
50
- switch ( usage )
53
+ switch ( usage )
51
54
{
52
- case CacheFactory . ReadOnly :
53
- if ( mutable )
55
+ case CacheFactory . ReadOnly :
56
+ if ( mutable )
54
57
{
55
58
log . Warn ( "read-only cache configured for mutable: " + name ) ;
56
59
}
57
60
ccs = new ReadOnlyCache ( ) ;
58
61
break ;
59
- case CacheFactory . ReadWrite :
62
+ case CacheFactory . ReadWrite :
60
63
ccs = new ReadWriteCache ( ) ;
61
64
break ;
62
- case CacheFactory . NonstrictReadWrite :
65
+ case CacheFactory . NonstrictReadWrite :
63
66
ccs = new NonstrictReadWriteCache ( ) ;
64
67
break ;
65
- default :
68
+ default :
66
69
throw new MappingException ( "cache usage attribute should be read-write, read-only, nonstrict-read-write, or transactional" ) ;
67
70
}
68
71
69
72
return ccs ;
70
-
73
+
71
74
}
72
75
73
76
}
74
- }
77
+ }
0 commit comments