Skip to content

Commit 223e90d

Browse files
Test uniqueness of cache per region
Added back from the old original commit which was later squashed with a commit giving-up this uniqueness.
1 parent dcee301 commit 223e90d

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/NHibernate.Test/CacheTest/BuildCacheFixture.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected override void Configure(Configuration configuration)
2828
}
2929

3030
[Theory]
31-
public void CommonRegionHasExpectedConcurrency(bool withPrefix)
31+
public void CommonRegionHasOneUniqueCacheAndExpectedConcurrency(bool withPrefix)
3232
{
3333
const string prefix = "Prefix";
3434
const string region = "Common";
@@ -70,6 +70,11 @@ public void CommonRegionHasExpectedConcurrency(bool withPrefix)
7070
Assert.That(relatedAConcurrencyCache, Is.InstanceOf<NonstrictReadWriteCache>(), "Unexpected concurrency for RelatedA");
7171
Assert.That(entityBConcurrencyCache, Is.InstanceOf<ReadOnlyCache>(), "Unexpected concurrency for EntityB");
7272
Assert.That(relatedBConcurrencyCache, Is.InstanceOf<ReadWriteCache>(), "Unexpected concurrency for RelatedB");
73+
Assert.That(entityACache, Is.SameAs(commonRegionCache), "Unexpected cache for EntityA");
74+
Assert.That(entityBCache, Is.SameAs(commonRegionCache), "Unexpected cache for EntityB");
75+
Assert.That(relatedACache, Is.SameAs(commonRegionCache), "Unexpected cache for RelatedA");
76+
Assert.That(relatedBCache, Is.SameAs(commonRegionCache), "Unexpected cache for RelatedB");
77+
Assert.That(queryCache, Is.SameAs(commonRegionCache), "Unexpected cache for query cache");
7378
});
7479
}
7580
finally

src/NHibernate/Cache/StandardQueryCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public partial class StandardQueryCache : IQueryCache, IBatchableQueryCache
2323
private readonly CacheBase _cache;
2424

2525
// Since v5.2
26-
[Obsolete("Please use overload with an CacheBase parameter.")]
26+
[Obsolete("Please use overload with a CacheBase parameter.")]
2727
public StandardQueryCache(
2828
Settings settings,
2929
IDictionary<string, string> props,

src/NHibernate/Cache/StandardQueryCacheFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace NHibernate.Cache
1111
public class StandardQueryCacheFactory : IQueryCacheFactory
1212
{
1313
// Since v5.2
14-
[Obsolete("Please use overload with an CacheBase parameter.")]
14+
[Obsolete("Please use overload with a CacheBase parameter.")]
1515
public IQueryCache GetQueryCache(string regionName,
1616
UpdateTimestampsCache updateTimestampsCache,
1717
Settings settings,

src/NHibernate/Cache/UpdateTimestampsCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public virtual void Clear()
2626
}
2727

2828
// Since v5.2
29-
[Obsolete("Please use overload with an CacheBase parameter.")]
29+
[Obsolete("Please use overload with a CacheBase parameter.")]
3030
public UpdateTimestampsCache(Settings settings, IDictionary<string, string> props)
3131
: this(
3232
CacheFactory.BuildCacheBase(

0 commit comments

Comments
 (0)