[Adapdev-commits] Adapdev/src/Adapdev.Cache AbstractCache.cs,1.6,1.7 Adapdev.Cache.csproj,1.10,1.11
Status: Beta
Brought to you by:
intesar66
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv909/src/Adapdev.Cache Added Files: AbstractCache.cs Adapdev.Cache.csproj CacheItem.cs CacheItemCollection.cs CacheItemDictionary.cs CacheItemEnumerator.cs CacheManager.cs CacheStats.cs CacheType.cs CacheUtil.cs FileCache.cs ICache.cs ICacheItem.cs ICacheStats.cs ImmutableInMemoryCache.cs MutableInMemoryCache.cs SerializedCacheItem.cs SqlServerCache.cs TypeKey.cs Log Message: --- NEW FILE: TypeKey.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for TypeKey. /// </summary> internal class TypeKey { public static string Build(Type t, string key) { return t.FullName + Separator + key; } public static string GetTypeName(string typekey) { return typekey.Substring(0, typekey.IndexOf(Separator)); } public static Type GetType(string typekey) { return Type.GetType(GetTypeName(typekey)); } public static string GetKey(string typekey) { return typekey.Substring(typekey.IndexOf(Separator), typekey.Length); } public static string Separator { get{return "---";} } } } --- NEW FILE: AbstractCache.cs --- using System; using Adapdev; namespace Adapdev.Cache { using System.Collections; using System.Timers; using Adapdev.Cache.Scavengers; /// <summary> /// Summary description for AbstractCache. /// </summary> public abstract class AbstractCache : LongLivingMarshalByRefObject, ICache { protected ArrayList _timers = new ArrayList(); protected ArrayList _scavengers = new ArrayList(); #region ICache Members public void Add(int key, object o) { this.Add(key.ToString(), o); } public void Remove(Type t, int key) { this.Remove(t, key.ToString()); } public object Get(Type t, int key) { return this.Get(t, key.ToString()); } public CacheItem GetCacheItem(Type t, int key) { return this.GetCacheItem(t, key.ToString()); } public bool Contains(Type t, int key) { return this.Contains(t, key.ToString()); } public void Scavenge(Adapdev.Cache.Scavengers.IScavenger scavenger) { scavenger.Scavenge(this); } public void Copy(ICache cache) { CacheUtil.Copy(cache, this); } public abstract void Add(string key, object o); public abstract void Clear(); public abstract bool Contains(Type t, string key); public abstract int Count{get;} public abstract CacheItem[] Entries{get;} public abstract object Get(Type t, string key); public abstract CacheItem GetCacheItem(Type t, string key); public abstract void Populate(); public abstract void Remove(Type t, string key); #endregion } } --- NEW FILE: CacheItem.cs --- using System; using Adapdev; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheItem. /// </summary> /// [Serializable] public class CacheItem : ICacheItem { protected object _object = null; protected string _key = String.Empty; protected int _ordinal = 0; protected DateTime _created; protected Type _objectType = null; public CacheItem(string key, object o) { this._key = key; this._object = o; this._created = DateTime.Now; this._objectType = o.GetType(); } public DateTime Created { get{return this._created;} } public Type ObjectType { get{return this._objectType;} } public virtual object Object { get{return this._object;} } public string Key { get{return this._key;} } public string TypeKey { get{return Adapdev.Cache.TypeKey.Build(this.ObjectType, this.Key);} } public int Ordinal { get{return this._ordinal;} set{this._ordinal = value;} } public override string ToString() { return Adapdev.Text.StringUtil.ToString(this); } } } --- NEW FILE: CacheManager.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheManager. /// </summary> public class CacheManager { private static ICache _cache = null; static CacheManager() { } public static ICache Cache { get { if(_cache == null) _cache = new ImmutableInMemoryCache(); return _cache; } set { if(_cache != null) { _cache.Clear(); } _cache = value; } } public static void SetCache(CacheType cacheType, bool copyExisting) { ICache cache = null; switch(cacheType) { case CacheType.File: cache = new FileCache(); if(copyExisting) cache.Copy(Cache); Cache = cache; break; case CacheType.ImmutableInMemory: cache = new ImmutableInMemoryCache(); if(copyExisting) cache.Copy(Cache); Cache = cache; break; case CacheType.MutableInMemory: cache = new MutableInMemoryCache(); if(copyExisting) cache.Copy(Cache); Cache = cache; break; default: break; } } public static void SetCache(CacheType cacheType) { SetCache(cacheType, true); } } } --- NEW FILE: ICacheStats.cs --- namespace Adapdev.Cache { /// <summary> /// Summary description for ICacheStats. /// </summary> public interface ICacheStats { int HitRate { get; } int MissRate { get; } long InsertTime { get; } long RetrieveTime { get; } } } --- NEW FILE: MutableInMemoryCache.cs --- using System; using System.Collections; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for ReadOnlyInMemoryCache. /// </summary> public class MutableInMemoryCache : AbstractCache { private CacheItemDictionary _hashtable = new CacheItemDictionary(); private int _ordinal = 0; public MutableInMemoryCache() { } #region ICache Members public override void Add(string key, object o) { CacheItem c = new CacheItem(key, o); c.Ordinal = ++this._ordinal; this._hashtable[TypeKey.Build(o.GetType(), key)] = c; } public override void Remove(Type t, string key) { this._hashtable.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { return (this._hashtable[TypeKey.Build(t, key)] as CacheItem).Object; } public override CacheItem GetCacheItem(Type t, string key) { return this._hashtable[TypeKey.Build(t, key)] as CacheItem; } public override void Clear() { this._hashtable.Clear(); } public override bool Contains(Type t, string key) { return this._hashtable.Contains(TypeKey.Build(t, key)); } public override int Count { get { return this._hashtable.Count; } } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._hashtable.Count]; this._hashtable.Values.CopyTo(items, 0); return items; } } public override void Populate() { } #endregion } } --- NEW FILE: CacheStats.cs --- using System; using Adapdev.Diagnostics; namespace Adapdev.Cache { using System.Text; using Adapdev.Cache.Scavengers; /// <summary> /// Summary description for CacheStats. /// </summary> public class CacheStats : ICache { private ICache _cache = null; private double _retrieveTime; private double _retrieveTimeAvg; private int _retrieved; private double _insertTimeAvg; private double _insertTime; private double _inserted; private int _hitCount; private int _missCount; private readonly IPerfTimer timer = PerfTimerFactory.GetPerfTimer(PerfTimerType.HIRESSECONDS); public CacheStats(ICache cache) { this._cache = cache; } #region ICache Members public void Add(string key, object o) { timer.Start(); this._cache.Add(key, o); timer.Stop(); this._insertTime = timer.Duration; this._insertTimeAvg += timer.Duration; this._inserted++; } public void Add(int key, object o) { this.Add(key.ToString(), o); } public void Remove(Type t, int key) { this.Remove(t, key.ToString()); } public void Remove(Type t, string key) { this._cache.Remove(t, key); } public object Get(Type t, int key) { return this.Get(t, key.ToString()); } public object Get(Type t, string key) { timer.Start(); object o = this._cache.Get(t, key); timer.Stop(); this._retrieveTime = timer.Duration; this._retrieveTimeAvg += timer.Duration; this._retrieved++; if(o == null) this._missCount++; else this._hitCount++; return o; } public CacheItem GetCacheItem(Type t, string key) { return this._cache.GetCacheItem(t, key); } public CacheItem GetCacheItem(Type t, int key) { return this._cache.GetCacheItem(t, key); } public void Clear() { this._cache.Clear(); this._hitCount = 0; this._inserted = 0; this._insertTime = 0; this._insertTimeAvg = 0; this._missCount = 0; this._retrieved = 0; this._retrieveTime = 0; this._retrieveTimeAvg = 0; } public int Count { get { return this._cache.Count; } } public bool Contains(Type t, string key) { return this._cache.Contains(t, key); } public bool Contains(Type t, int key) { return this._cache.Contains(t, key); } public void Scavenge(Adapdev.Cache.Scavengers.IScavenger scavenger) { this._cache.Scavenge(scavenger); } public CacheItem[] Entries { get { return this._cache.Entries; } } public void Populate() { this._cache.Populate(); } public void Copy(ICache cache) { this._cache.Copy(cache); } #endregion public double RetrieveTime { get{return this._retrieveTime;} } public double InsertTime { get{return this._insertTime;} } public double AverageRetrieveTime { get{return this._retrieveTimeAvg / this._retrieved;} } public double AverageInsertTime { get{return this._insertTimeAvg / this._inserted;} } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Insert Time: {0}\r\n", this.InsertTime); sb.AppendFormat("Avg. Insert Time: {0}\r\n", this.AverageInsertTime); sb.AppendFormat("Retrieve Time: {0}\r\n", this.RetrieveTime); sb.AppendFormat("Avg. Retrieve Time: {0}\r\n", this.AverageRetrieveTime); sb.AppendFormat("Hit Count: {0}\r\n", this.HitCount); sb.AppendFormat("Miss Count: {0}\r\n", this.MissCount); return sb.ToString(); } public ICache Cache { get{return this._cache;} } public int HitCount { get{return this._hitCount;} } public int MissCount { get{return this._missCount;} } public void Scavenge(IScavenger scavenger, TimeSpan timespan) { this.Scavenge(scavenger, timespan); } } } --- NEW FILE: SqlServerCache.cs --- namespace Adapdev.Cache { /// <summary> /// Summary description for SqlServerCache. /// </summary> public class SqlServerCache : ICache { public SqlServerCache() { // // TODO: Add constructor logic here // } #region ICache Members public void Add(string id, object item) { // TODO: Add SqlServerCache.Add implementation } public void Remove(string id) { // TODO: Add SqlServerCache.Remove implementation } public object Get(string id) { // TODO: Add SqlServerCache.Get implementation return null; } public CacheMetaData GetMetaData(string id) { return null; } public CacheMetaDataDictionary GetMetaData() { return null; } public void Clear() { // TODO: Add SqlServerCache.Clear implementation } public int Count { get { // TODO: Add SqlServerCache.Count getter implementation return 0; } } public void SetScavenger(IScavenger scavenger) { // TODO: Add SqlServerCache.SetScavenger implementation } public bool Contains(string id) { return false; } #endregion } } --- NEW FILE: SerializedCacheItem.cs --- using System; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for SerializedCacheItem. /// </summary> /// [Serializable] public class SerializedCacheItem : CacheItem { public SerializedCacheItem(string key, object o) : base(key, o) { this._key = key; this._object = Serializer.SerializeToBinary(o); this._created = DateTime.Now; this._objectType = o.GetType(); } public override object Object { get { return Serializer.DeserializeFromBinary(this._objectType, this._object as byte[]); } } public byte[] BinaryObject { get{return this._object as byte[];} } } } --- NEW FILE: CacheType.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheType. /// </summary> public enum CacheType { File, ImmutableInMemory, MutableInMemory } } --- NEW FILE: CacheItemCollection.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using System.Collections; namespace Adapdev.Cache { [Serializable()] public class CacheItemCollection : CollectionBase { public CacheItemCollection() { } public CacheItemCollection(IList value) { this.AddRange(value); } public CacheItemCollection(CacheItem[] value) { this.AddRange(value); } public CacheItem this[int index] { get { return ((CacheItem)(List[index])); } set { List[index] = value; } } public int Add(CacheItem value) { return List.Add(value); } public void AddRange(CacheItem[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } } public void AddRange(IList value) { for (int i = 0; (i < value.Count); i = (i + 1)) { this.Add((CacheItem)value[i]); } } public bool Contains(CacheItem value) { return List.Contains(value); } public void CopyTo(CacheItem[] array, int index) { List.CopyTo(array, index); } public int IndexOf(CacheItem value) { return List.IndexOf(value); } public void Insert(int index, CacheItem value) { List.Insert(index, value); } public new CacheItemEnumerator GetEnumerator() { return new CacheItemEnumerator(this); } public void Remove(CacheItem value) { List.Remove(value); } } } --- NEW FILE: Adapdev.Cache.csproj --- <VisualStudioProject> <CSHARP ProjectType = "Local" ProductVersion = "7.10.3077" SchemaVersion = "2.0" ProjectGuid = "{84F894AC-EFD7-4342-B2A5-CF3EF80E0B1C}" > <Build> <Settings ApplicationIcon = "" AssemblyKeyContainerName = "" AssemblyName = "Adapdev.Cache" AssemblyOriginatorKeyFile = "" DefaultClientScript = "JScript" DefaultHTMLPageLayout = "Grid" DefaultTargetSchema = "IE50" DelaySign = "false" OutputType = "Library" PreBuildEvent = "" PostBuildEvent = "" RootNamespace = "Adapdev.Cache" RunPostBuildEvent = "OnBuildSuccess" StartupObject = "" > <Config Name = "Debug" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "DEBUG;TRACE" DocumentationFile = "" DebugSymbols = "true" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "false" OutputPath = "bin\Debug\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> <Config Name = "Release" AllowUnsafeBlocks = "false" BaseAddress = "285212672" CheckForOverflowUnderflow = "false" ConfigurationOverrideFile = "" DefineConstants = "TRACE" DocumentationFile = "" DebugSymbols = "false" FileAlignment = "4096" IncrementalBuild = "false" NoStdLib = "false" NoWarn = "" Optimize = "true" OutputPath = "bin\Release\" RegisterForComInterop = "false" RemoveIntegerChecks = "false" TreatWarningsAsErrors = "false" WarningLevel = "4" /> </Settings> <References> <Reference Name = "System" AssemblyName = "System" HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll" /> <Reference Name = "System.Data" AssemblyName = "System.Data" HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll" /> <Reference Name = "System.XML" AssemblyName = "System.Xml" HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll" /> <Reference Name = "Adapdev" Project = "{CC30A321-2569-4B1F-8E1A-781B5509B56D}" Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> <Reference Name = "log4net" AssemblyName = "log4net" HintPath = "..\..\lib\log4net.dll" /> </References> </Build> <Files> <Include> <File RelPath = "AbstractCache.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "AdapdevAssemblyInfo.cs" Link = "..\AdapdevAssemblyInfo.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheItemCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheItemDictionary.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheItemEnumerator.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheManager.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheStats.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheType.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "CacheUtil.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "FileCache.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ICache.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ICacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "ImmutableInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "MutableInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "SerializedCacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "TypeKey.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Scavengers\AbsoluteExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Scavengers\GreaterThanOrdinalScavenger.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Scavengers\IScavenger.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Scavengers\LIFONumberScavenger.cs" SubType = "Code" BuildAction = "Compile" /> <File RelPath = "Scavengers\SlidingExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" /> </Include> </Files> </CSHARP> </VisualStudioProject> --- NEW FILE: CacheUtil.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheUtil. /// </summary> public class CacheUtil { private CacheUtil(){} public static void Copy(ICache source, ICache target) { foreach(CacheItem item in source.Entries) { target.Add(item.Key, item.Object); } } } } --- NEW FILE: CacheItemEnumerator.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using System.Collections; namespace Adapdev.Cache { public class CacheItemEnumerator : IEnumerator { private IEnumerator baseEnumerator; private IEnumerable temp; public CacheItemEnumerator(CacheItemCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } public CacheItemEnumerator(CacheItemDictionary mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } public CacheItem Current { get { return ((CacheItem)(baseEnumerator.Current)); } } object IEnumerator.Current { get { return baseEnumerator.Current; } } public bool MoveNext() { return baseEnumerator.MoveNext(); } bool IEnumerator.MoveNext() { return baseEnumerator.MoveNext(); } public void Reset() { baseEnumerator.Reset(); } void IEnumerator.Reset() { baseEnumerator.Reset(); } } } --- NEW FILE: FileCache.cs --- using System; using System.Collections; using System.IO; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for FileCache. /// </summary> public class FileCache : AbstractCache { private string _folderPath = String.Empty; private CacheItemDictionary _items = new CacheItemDictionary(); private static int _ordinal = 0; public FileCache() { this._folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filecache"); if(!Directory.Exists(this._folderPath)) Directory.CreateDirectory(this._folderPath); FileCache._ordinal = this.Count; } public FileCache(string folderName) { this._folderPath = folderName; this._folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filecache"); if(!Directory.Exists(this._folderPath)) Directory.CreateDirectory(this._folderPath); FileCache._ordinal = this.Count; } private string GetFileName(Type t, string key) { return TypeKey.Build(t, key) + ".cache"; } private string GetFullFileName(Type t, string key) { return Path.Combine(this._folderPath, this.GetFileName(t, key)); } private string GetFileNameWithoutExtension(string fileName) { return fileName.Substring(0, fileName.LastIndexOf(".")); } #region ICache Members public override void Add(string key, object o) { SerializedCacheItem c = new SerializedCacheItem(key, o); c.Ordinal = ++FileCache._ordinal; this._items[TypeKey.Build(o.GetType(), key)] = c; Serializer.SerializeToBinary(o, Path.Combine(this._folderPath, this.GetFileName(o.GetType(), key))); } public override void Remove(Type t, string key) { File.Delete(Path.Combine(this._folderPath, this.GetFileName(t, key))); this._items.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { string typekey = TypeKey.Build(t, key); if(this._items.Contains(typekey)) { return (this._items[typekey] as SerializedCacheItem).Object; } else if(this.Contains(t, key)) { return Serializer.DeserializeFromBinary(t, this.GetFileName(t, key)); } else { return null; } } public override CacheItem GetCacheItem(Type t, string key) { return this._items[TypeKey.Build(t, key)] as SerializedCacheItem; } public override void Clear() { if(Directory.Exists(this._folderPath)) { Directory.Delete(this._folderPath, true); Directory.CreateDirectory(this._folderPath); this._items.Clear(); } } public override int Count { get { return Directory.GetFiles(this._folderPath).Length; } } public override bool Contains(Type t, string key) { return File.Exists(this.GetFullFileName(t, key)); } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._items.Count]; this._items.Values.CopyTo(items, 0); return items; } } public override void Populate() { foreach(FileInfo f in new DirectoryInfo(this._folderPath).GetFiles()) { string fileName = this.GetFileNameWithoutExtension(f.Name); SerializedCacheItem c = new SerializedCacheItem(TypeKey.GetKey(fileName), Serializer.DeserializeFromBinary(TypeKey.GetType(fileName), f.FullName)); c.Ordinal = FileCache._ordinal++; this._items[f.Name] = c; } } #endregion } } --- NEW FILE: ICache.cs --- using System; using System.Collections; using Adapdev.Cache.Scavengers; namespace Adapdev.Cache { /// <summary> /// Summary description for ICache. /// </summary> public interface ICache { void Add(string key, object o); void Add(int key, object o); void Remove(Type t, int key); void Remove(Type t, string key); object Get(Type t, int key); object Get(Type t, string key); CacheItem GetCacheItem(Type t, string key); CacheItem GetCacheItem(Type t, int key); void Clear(); int Count{get;} bool Contains(Type t, string key); bool Contains(Type t, int key); void Scavenge(IScavenger scavenger); CacheItem[] Entries{get;} void Populate(); void Copy(ICache cache); } } --- NEW FILE: ImmutableInMemoryCache.cs --- using System; using System.Collections; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for ReadOnlyInMemoryCache. /// </summary> public class ImmutableInMemoryCache : AbstractCache { private CacheItemDictionary _hashtable = new CacheItemDictionary(); private int _ordinal = 0; public ImmutableInMemoryCache() { } #region ICache Members public override void Add(string key, object o) { SerializedCacheItem c = new SerializedCacheItem(key, o); c.Ordinal = ++this._ordinal; this._hashtable[TypeKey.Build(o.GetType(), key)] = c; } public override void Remove(Type t, string key) { this._hashtable.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { return (this._hashtable[TypeKey.Build(t, key)] as CacheItem).Object; } public override CacheItem GetCacheItem(Type t, string key) { return this._hashtable[TypeKey.Build(t, key)] as CacheItem; } public override void Clear() { this._hashtable.Clear(); } public override bool Contains(Type t, string key) { return this._hashtable.Contains(TypeKey.Build(t, key)); } public override int Count { get { return this._hashtable.Count; } } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._hashtable.Count]; this._hashtable.Values.CopyTo(items, 0); return items; } } public override void Populate() { } #endregion } } --- NEW FILE: ICacheItem.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for ICacheItem. /// </summary> public interface ICacheItem { DateTime Created{get;} Type ObjectType{get;} object Object{get;} string Key{get;} int Ordinal{get;set;} } } --- NEW FILE: CacheItemDictionary.cs --- using System; using System.Collections; namespace Adapdev.Cache { public class CacheItemDictionary : DictionaryBase { public CacheItem this[ object key ] { get { return( (CacheItem) Dictionary[key] ); } set { Dictionary[key] = value; } } public ICollection Keys { get { return( Dictionary.Keys ); } } public ICollection Values { get { return( Dictionary.Values ); } } public void Add( String key, String value ) { Dictionary.Add( key, value ); } public bool Contains( String key ) { return( Dictionary.Contains( key ) ); } public void Remove( String key ) { Dictionary.Remove( key ); } } } |