[摘要]Container.Config.CommandBuffer >0)//如果组件允许对象缓存 _list = new System.Collections.ArrayList();...
Container.Config.CommandBuffer >0)//如果组件允许对象缓存
{
_list = new System.Collections.ArrayList();
_list.Add(value);
_Cache.Add(key,_list);
}
}
}
}
/// <summary>
/// 从缓存中获取相关命令对象
/// </summary>
/// <param name="key">标识</param>
/// <returns>IPersistentCommand</returns>
public override object GetObject(object key)
{
if(_Cache.Contains(key))//如果命令存在缓冲中
{
foreach(IPersistentCommand cmd in (System.Collections.IList)_Cache[key])
{
if(!cmd.State)//命令是否可以过行锁定
if(cmd.Lock())//命令锁定
return cmd;
}
}
return null;
}
}
关键词:缓存类的完成(C#)