public bool AddCache(string key, object data)
{
lock (CacheManager._lockObject)
{
if (this._cacheContent.ContainsKey(key))
{
CacheItem cacheItem = this._cacheContent[key];
if (cacheItem != null)
{
if (DateTime.Now.Subtract(cacheItem.CachedTime).Milliseconds >= CacheManager.CacheDuration)
{
this._cacheContent.Remove(key);
this._cacheContent.Add(key, new CacheItem(data, DateTime.Now));
}
}
}
else
{
CacheItem cacheItem = new CacheItem(data, DateTime.Now);
this._cacheContent.Add(key, cacheItem);
}
}
return true;
}