[Adapdev-commits] Adapdev/src/Adapdev.Cache CacheType.cs,1.2,1.3 Adapdev.Cache.csproj,1.6,1.7 CacheM
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-11-02 13:45:23
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7036/src/Adapdev.Cache Modified Files: Adapdev.Cache.csproj CacheManager.cs Added Files: CacheType.cs Log Message: Improved ObjectComparer to include field comparisons Added AssociationType for ForeignKeyAssociations Improved CacheManager and associated tests --- NEW FILE: CacheType.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheType. /// </summary> public enum CacheType { File, ImmutableInMemory, MutableInMemory } } Index: Adapdev.Cache.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Adapdev.Cache.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Adapdev.Cache.csproj 2 Jun 2005 03:25:59 -0000 1.6 --- Adapdev.Cache.csproj 2 Nov 2005 13:45:12 -0000 1.7 *************** *** 136,139 **** --- 136,144 ---- /> <File + RelPath = "CacheType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "CacheUtil.cs" SubType = "Code" Index: CacheManager.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheManager.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CacheManager.cs 20 Jun 2005 01:47:49 -0000 1.3 --- CacheManager.cs 2 Nov 2005 13:45:12 -0000 1.4 *************** *** 31,34 **** --- 31,65 ---- } } + + 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); + } } } |