@@ -17,27 +17,22 @@ namespace NHibernate.Cache
17
17
public partial class UpdateTimestampsCache
18
18
{
19
19
private static readonly INHibernateLogger log = NHibernateLogger . For ( typeof ( UpdateTimestampsCache ) ) ;
20
- // 6.0 TODO: type as CacheBase instead
21
- #pragma warning disable 618
22
- private readonly ICache updateTimestamps ;
23
- #pragma warning restore 618
24
- private readonly CacheBase _batchUpdateTimestamps ;
20
+ private readonly CacheBase _updateTimestamps ;
25
21
26
22
private readonly string regionName = typeof ( UpdateTimestampsCache ) . Name ;
27
23
28
24
public virtual void Clear ( )
29
25
{
30
- updateTimestamps . Clear ( ) ;
26
+ _updateTimestamps . Clear ( ) ;
31
27
}
32
28
33
29
public UpdateTimestampsCache ( Settings settings , IDictionary < string , string > props )
34
30
{
35
31
string prefix = settings . CacheRegionPrefix ;
36
32
regionName = prefix == null ? regionName : prefix + '.' + regionName ;
37
33
log . Info ( "starting update timestamps cache at region: {0}" , regionName ) ;
38
- updateTimestamps = settings . CacheProvider . BuildCache ( regionName , props ) ;
39
- // ReSharper disable once SuspiciousTypeConversion.Global
40
- _batchUpdateTimestamps = updateTimestamps as CacheBase ?? new ObsoleteCacheWrapper ( updateTimestamps ) ;
34
+ var updateTimestamps = settings . CacheProvider . BuildCache ( regionName , props ) ;
35
+ _updateTimestamps = updateTimestamps as CacheBase ?? new ObsoleteCacheWrapper ( updateTimestamps ) ;
41
36
}
42
37
43
38
//Since v5.1
@@ -52,10 +47,10 @@ public void PreInvalidate(object[] spaces)
52
47
public virtual void PreInvalidate ( IReadOnlyCollection < string > spaces )
53
48
{
54
49
//TODO: to handle concurrent writes correctly, this should return a Lock to the client
55
- long ts = updateTimestamps . NextTimestamp ( ) + updateTimestamps . Timeout ;
50
+ long ts = _updateTimestamps . NextTimestamp ( ) + _updateTimestamps . Timeout ;
56
51
foreach ( var space in spaces )
57
52
{
58
- updateTimestamps . Put ( space , ts ) ;
53
+ _updateTimestamps . Put ( space , ts ) ;
59
54
}
60
55
61
56
//TODO: return new Lock(ts);
@@ -73,12 +68,12 @@ public void Invalidate(object[] spaces)
73
68
public virtual void Invalidate ( IReadOnlyCollection < string > spaces )
74
69
{
75
70
//TODO: to handle concurrent writes correctly, the client should pass in a Lock
76
- long ts = updateTimestamps . NextTimestamp ( ) ;
71
+ long ts = _updateTimestamps . NextTimestamp ( ) ;
77
72
//TODO: if lock.getTimestamp().equals(ts)
78
73
foreach ( var space in spaces )
79
74
{
80
75
log . Debug ( "Invalidating space [{0}]" , space ) ;
81
- updateTimestamps . Put ( space , ts ) ;
76
+ _updateTimestamps . Put ( space , ts ) ;
82
77
}
83
78
}
84
79
@@ -91,7 +86,7 @@ public virtual bool IsUpToDate(ISet<string> spaces, long timestamp /* H2.1 has L
91
86
{
92
87
keys [ index ++ ] = space ;
93
88
}
94
- var lastUpdates = _batchUpdateTimestamps . GetMany ( keys ) ;
89
+ var lastUpdates = _updateTimestamps . GetMany ( keys ) ;
95
90
foreach ( var lastUpdate in lastUpdates )
96
91
{
97
92
if ( IsOutdated ( lastUpdate , timestamp ) )
@@ -106,7 +101,7 @@ public virtual void Destroy()
106
101
{
107
102
try
108
103
{
109
- updateTimestamps . Destroy ( ) ;
104
+ _updateTimestamps . Destroy ( ) ;
110
105
}
111
106
catch ( Exception e )
112
107
{
0 commit comments