diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/ICache.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/ICache.cs
new file mode 100644
index 00000000..46257ac6
--- /dev/null
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/ICache.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace MvcSiteMapProvider.Caching
+{
+ ///
+ /// Contract for a class to provide type-safe access to a cache dictionary.
+ ///
+ public interface ICache
+ {
+ T GetValue(string key);
+ void SetValue(string key, T value);
+ }
+}
\ No newline at end of file
diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/IRequestCache.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/IRequestCache.cs
index c93908c1..fd7dbbd0 100644
--- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/IRequestCache.cs
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Caching/IRequestCache.cs
@@ -6,8 +6,7 @@ namespace MvcSiteMapProvider.Caching
/// Contract for a class to provide type-safe access to a request-level cache.
///
public interface IRequestCache
+ : ICache
{
- T GetValue(string key);
- void SetValue(string key, T value);
}
}
diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/RequestCacheableDictionary.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/CacheableDictionary.cs
similarity index 87%
rename from src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/RequestCacheableDictionary.cs
rename to src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/CacheableDictionary.cs
index 4c786576..729e3334 100644
--- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/RequestCacheableDictionary.cs
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/CacheableDictionary.cs
@@ -10,22 +10,22 @@ namespace MvcSiteMapProvider.Collections
/// mode will automatically switch to a writeable request-cached copy of the original dictionary
/// during any write operation.
///
- public class RequestCacheableDictionary
+ public class CacheableDictionary
: LockableDictionary
{
- public RequestCacheableDictionary(
+ public CacheableDictionary(
ISiteMap siteMap,
- IRequestCache requestCache
+ ICache cache
)
: base(siteMap)
{
- if (requestCache == null)
- throw new ArgumentNullException("requestCache");
+ if (cache == null)
+ throw new ArgumentNullException("cache");
- this.requestCache = requestCache;
+ this.cache = cache;
}
- protected readonly IRequestCache requestCache;
+ protected readonly ICache cache;
protected readonly Guid instanceId = Guid.NewGuid();
#region Write Operations
@@ -157,7 +157,7 @@ public override ICollection Values
///
/// Override this property and set it to false to disable all caching operations.
///
- protected virtual bool RequestCachingEnabled
+ protected virtual bool CachingEnabled
{
get { return true; }
}
@@ -165,7 +165,7 @@ protected virtual bool RequestCachingEnabled
protected virtual string GetCacheKey()
{
- return "__REQUEST_CACHEABLE_DICTIONARY_" + this.instanceId.ToString();
+ return "__CACHEABLE_DICTIONARY_" + this.instanceId.ToString();
}
@@ -177,10 +177,10 @@ protected virtual IDictionary ReadOperationDictionary
get
{
IDictionary result = null;
- if (this.RequestCachingEnabled)
+ if (this.CachingEnabled)
{
var key = this.GetCacheKey();
- result = this.requestCache.GetValue>(key);
+ result = this.cache.GetValue>(key);
if (result == null)
{
// Request is not cached, return base dictionary
@@ -203,10 +203,10 @@ protected virtual IDictionary WriteOperationDictionary
get
{
IDictionary result = null;
- if (this.IsReadOnly && this.RequestCachingEnabled)
+ if (this.IsReadOnly && this.CachingEnabled)
{
var key = this.GetCacheKey();
- result = this.requestCache.GetValue>(key);
+ result = this.cache.GetValue>(key);
if (result == null)
{
// This is the first write operation request in read-only mode,
@@ -214,7 +214,7 @@ protected virtual IDictionary WriteOperationDictionary
// with a copy of the current values.
result = new Dictionary();
base.CopyTo(result);
- this.requestCache.SetValue>(key, result);
+ this.cache.SetValue>(key, result);
}
}
else
diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/RequestCacheableList.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/CacheableList.cs
similarity index 92%
rename from src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/RequestCacheableList.cs
rename to src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/CacheableList.cs
index 2bc49dcb..edeeadbe 100644
--- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/RequestCacheableList.cs
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/CacheableList.cs
@@ -1,5 +1,5 @@
-// This class has infinite recursion problems. This was avoided in the RequestCacheableDictionary class because its base
+// This class has infinite recursion problems. This was avoided in the CacheableDictionary class because its base
// class stores the dictionary in a wrapped instance that has protected access. Unfortunately, with List that isn't the case.
// So for this to work, its base class needs to wrap a List and override all members of List or it needs to inherit
// from a base class that does same and exposes the internal list at least at the protected level.
@@ -18,22 +18,22 @@
// /// mode will automatically switch to a writeable request-cached copy of the original list
// /// during any write operation.
// ///
-// public class RequestCacheableList
+// public class CacheableList
// : LockableList
// {
-// public RequestCacheableList(
+// public CacheableList(
// ISiteMap siteMap,
-// IRequestCache requestCache
+// ICache cache
// )
// : base(siteMap)
// {
-// if (requestCache == null)
-// throw new ArgumentNullException("requestCache");
+// if (cache == null)
+// throw new ArgumentNullException("cache");
-// this.requestCache = requestCache;
+// this.cache = cache;
// }
-// protected readonly IRequestCache requestCache;
+// protected readonly ICache cache;
// protected readonly Guid instanceId = Guid.NewGuid();
// #region Write Operations
@@ -308,7 +308,7 @@
// ///
// /// Override this property and set it to false to disable all caching operations.
// ///
-// protected virtual bool RequestCachingEnabled
+// protected virtual bool CachingEnabled
// {
// get { return true; }
// }
@@ -316,7 +316,7 @@
// protected virtual string GetCacheKey()
// {
-// return "__REQUEST_CACHEABLE_LIST_" + this.instanceId.ToString();
+// return "__CACHEABLE_LIST_" + this.instanceId.ToString();
// }
@@ -328,10 +328,10 @@
// get
// {
// LockableList result = null;
-// if (this.RequestCachingEnabled)
+// if (this.CachingEnabled)
// {
// var key = this.GetCacheKey();
-// result = this.requestCache.GetValue>(key);
+// result = this.cache.GetValue>(key);
// if (result == null)
// {
// // Request is not cached, return base list
@@ -355,10 +355,10 @@
// get
// {
// LockableList result = null;
-// if (this.IsReadOnly && this.RequestCachingEnabled)
+// if (this.IsReadOnly && this.CachingEnabled)
// {
// var key = this.GetCacheKey();
-// result = this.requestCache.GetValue>(key);
+// result = this.cache.GetValue>(key);
// if (result == null)
// {
// // This is the first write operation request in read-only mode,
@@ -366,7 +366,7 @@
// // with a copy of the current values.
// result = new LockableList(this.siteMap);
// base.CopyTo(result);
-// this.requestCache.SetValue>(key, result);
+// this.cache.SetValue>(key, result);
// }
// }
// else
diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/AttributeDictionary.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/AttributeDictionary.cs
index e36ab19c..f3f8c566 100644
--- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/AttributeDictionary.cs
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/AttributeDictionary.cs
@@ -12,14 +12,14 @@ namespace MvcSiteMapProvider.Collections.Specialized
/// localization of custom attributes.
///
public class AttributeDictionary
- : RequestCacheableDictionary, IAttributeDictionary
+ : CacheableDictionary, IAttributeDictionary
{
public AttributeDictionary(
ISiteMap siteMap,
ILocalizationService localizationService,
- IRequestCache requestCache
+ ICache cache
)
- : base(siteMap, requestCache)
+ : base(siteMap, cache)
{
if (localizationService == null)
throw new ArgumentNullException("localizationService");
diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs
index e1cb64bd..1cc540cf 100644
--- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs
@@ -11,12 +11,12 @@ namespace MvcSiteMapProvider.Collections.Specialized
/// the behavior of the route values.
///
public class RouteValueDictionary
- : RequestCacheableDictionary, IRouteValueDictionary
+ : CacheableDictionary, IRouteValueDictionary
{
public RouteValueDictionary(
ISiteMap siteMap,
- IRequestCache requestCache
- ) : base(siteMap, requestCache)
+ ICache cache
+ ) : base(siteMap, cache)
{
}
diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/MvcSiteMapProvider.csproj b/src/MvcSiteMapProvider/MvcSiteMapProvider/MvcSiteMapProvider.csproj
index a601681a..d25e5ecb 100644
--- a/src/MvcSiteMapProvider/MvcSiteMapProvider/MvcSiteMapProvider.csproj
+++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/MvcSiteMapProvider.csproj
@@ -106,6 +106,7 @@
+
@@ -129,8 +130,8 @@
-
-
+
+