Skip to content

Commit

Permalink
Backport of r122839.
Browse files Browse the repository at this point in the history
svn path=/branches/mono-2-2/mcs/; revision=122841
  • Loading branch information
grendello committed Jan 8, 2009
1 parent 5b8bf83 commit 4291f2a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mcs/class/System.Web/System.Web.Caching/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public object Get (string key)

if (it.SlidingExpiration != NoSlidingExpiration) {
it.AbsoluteExpiration = DateTime.Now + it.SlidingExpiration;
it.Timer.Change ((int)it.SlidingExpiration.TotalMilliseconds, Timeout.Infinite);
// Cast to long is ok since we know that sliding expiration
// is less than 365 days (31536000000ms)
it.Timer.Change ((long)it.SlidingExpiration.TotalMilliseconds, Timeout.Infinite);
} else if (DateTime.Now >= it.AbsoluteExpiration) {
Remove (key, CacheItemRemovedReason.Expired, false);
return null;
Expand Down
8 changes: 8 additions & 0 deletions mcs/class/System.Web/System.Web.Caching/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2009-01-09 Marek Habersack <mhabersack@novell.com>

* Cache.cs: System.Threading.Timer.Change takes a long, not an
int. The maximum value of sliding expiration is 365 days
(31536000000ms) which fits within the value range of long. The
previous cast to int might yield negative values in certain
situations which was the reason for bug #464221. Fixes bug #464221

2008-10-21 Marek Habersack <mhabersack@novell.com>

* OutputCacheModule.cs: seal the class.
Expand Down

0 comments on commit 4291f2a

Please sign in to comment.