Creating an Absolute or Sliding Cache Dependency

This post is as much about making a mental note as it is about anything new.  As part of the project that is creating an RSS feed from a VSS database, I wanted to to perfrom some caching of the feed.  If you haven't worked with the ActiveX component that provides the API to VSS, trust me when I say that it's slow.  And because the retrieval of the history is recursive, the slowness can be magnified by an order of magnitude.  So given the lack of volitility of the data, caching seemed in order.

Now there is a fair bit of information about how to add items to the ASP.NET Cache object.  The Insert method is used, followed by a number of parameters.  And because there are different combinations of criteria that can be used to identify when the cached item expires, the Insert method has a number of different overloads.  The one that I'm interested in is

Cache.Insert(string, object, CacheDependency, DateTime, TimeSpan)

This particular overload is used to specify a cache dependency and either an absolute or a sliding expiration time.  Ignore the cache dependency, as it is not germaine to the discussion.  The issue arises when trying to specify either an absolute expiration time or the sliding time span.  Since these choices are mutually exclusive, my problem was how to correctly provide a null value for the unimportant parameter.  In my case, it was how to define a 'null' TimeSpan, as I wanted to use an absolute expiration. It took a little bit of searching before I found the answer (which, by the way, is the reason for this post...future documentation).

To define an absolute expiration, use TimeSpan.Zero as the last value.  For example:

Cache.Insert(”key”, value, null, DateTime.Now.AddMinutes(15), TimeSpan.Zero)

To define a sliding expiration, use DateTime.Now as the fourth parameter.  For example:

Cache.Insert(”key”, value, null, DateTime.Now, new TimeSpan(0, 15, 0))

My instinct (although I have nothing to back it up) is that under the covers the Insert method uses both parmaeter values to determine when the expiration should take place.  But regardless, I'm left wondering why this particular overload exists.  Why is there not one overload for absolute expiration and another for sliding?  The signatures would be different, so that's not the reason.  It wouldn't conflict with one of the other signatures. I'm left scratching my head.  Hopefully someone out there in the blogsphere who's reading this post will have an answer. 

Beuller?   Beuller?