回复 1# 大川 的帖子
看了下Discuz.Cache的内容,发现依然和2.6版本的类似,其中该 DefaultCacheStrategy类中
// Methods
public void AddObject(string objId, object o)
{
if (((objId != null) && (objId.Length != 0)) && (o != null))
{
CacheItemRemovedCallback onRemoveCallback = new CacheItemRemovedCallback(this.onRemove);
if (this.TimeOut == 0x1770)
{
webCache.Insert(objId, o, null, DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.High, onRemoveCallback);
}
else
{
webCache.Insert(objId, o, null, DateTime.Now.AddMinutes((double) this.TimeOut), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemoveCallback);
}
}
}
public void AddObjectWith(string objId, object o)
{
if (((objId != null) && (objId.Length != 0)) && (o != null))
{
CacheItemRemovedCallback onRemoveCallback = new CacheItemRemovedCallback(this.onRemove);
webCache.Insert(objId, o, null, DateTime.Now.AddHours((double) this.TimeOut), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemoveCallback);
}
}
这个方法中,缓存的时间前者是AddMinutes后者是AddHours,而代码中this.TimeOut是以分钟计算的,哪么如果同时按照分钟来计算,这里是不是缓存的有问题。还是这里我的理解有问题...