Explorar el Código

2006-08-03 Gonzalo Paniagua Javier <[email protected]>

	* CacheDependency.cs:
	* Cache.cs: check dependencies on other cache keys. Fixes bug #79002.


svn path=/trunk/mcs/; revision=63303
Gonzalo Paniagua Javier hace 19 años
padre
commit
0d5ff18ed0

+ 9 - 2
mcs/class/System.Web/System.Web.Caching/Cache.cs

@@ -78,12 +78,19 @@ namespace System.Web.Caching
 				CacheItem it = (CacheItem) cache [key];
 				if (it == null)
 					return null;
-				if (it.SlidingExpiration != NoSlidingExpiration)
+
+				if (it.Dependency != null && it.Dependency.HasChanged) {
+					Remove (it.Key, CacheItemRemovedReason.DependencyChanged);
+					return null;
+				}
+
+				if (it.SlidingExpiration != NoSlidingExpiration) {
 					it.AbsoluteExpiration = DateTime.Now + it.SlidingExpiration;
-				else if (DateTime.Now >= it.AbsoluteExpiration) {
+				} else if (DateTime.Now >= it.AbsoluteExpiration) {
 					Remove (key, CacheItemRemovedReason.Expired);
 					return null;
 				}
+
 				return it.Value;
 			}
 		}

+ 5 - 7
mcs/class/System.Web/System.Web.Caching/CacheDependency.cs

@@ -164,13 +164,11 @@ namespace System.Web.Caching
 				if (DateTime.Now < start)
 					return false;
 
-				if (cache != null) {
-					if (cachekeys != null) {
-						foreach (string key in cachekeys) {
-							if (cache.GetKeyLastChange (key) > start) {
-								hasChanged = true;
-								break;
-							}
+				if (cache != null && cachekeys != null) {
+					foreach (string key in cachekeys) {
+						if (cache.GetKeyLastChange (key) > start) {
+							hasChanged = true;
+							break;
 						}
 					}
 				}

+ 5 - 0
mcs/class/System.Web/System.Web.Caching/ChangeLog

@@ -1,3 +1,8 @@
+2006-08-03 Gonzalo Paniagua Javier <[email protected]>
+
+	* CacheDependency.cs:
+	* Cache.cs: check dependencies on other cache keys. Fixes bug #79002.
+
 2006-03-18  Robert Jordan  <[email protected]>
 
 	* OutputCacheModule.cs: invoke the validation callbacks of