void UpdateCache ()
{
if (!EnableCaching)
return;
if (DataCache == null)
return;
if (DataCache [GetDataKey ()] != null)
DataCache.Remove (GetDataKey ());
DateTime absoluteExpiration = Cache.NoAbsoluteExpiration;
TimeSpan slidindExpiraion = Cache.NoSlidingExpiration;
if (CacheDuration > 0) {
if (CacheExpirationPolicy == DataSourceCacheExpiry.Absolute)
absoluteExpiration = DateTime.Now.AddSeconds (CacheDuration);
else
slidindExpiraion = new TimeSpan (CacheDuration * 10000L);
}
CacheDependency dependency = null;
if (CacheKeyDependency.Length > 0)
dependency = new CacheDependency (new string [] { }, new string [] { CacheKeyDependency });
else
dependency = new CacheDependency (new string [] { }, new string [] { });
DataCache.Add (GetDataKey (), xmlDocument, dependency,
absoluteExpiration, slidindExpiraion, CacheItemPriority.Default, null);
}