现在的位置: 首页 > 综合 > 正文

让自己的框架实现缓存的功能

2012年07月26日 ⁄ 综合 ⁄ 共 4167字 ⁄ 字号 评论关闭

在剥离的过程中,我去除了BackingStoreImplementations下的大部分,去除了Instrumentation的全部<用于做日志还有计数器之类用途的> 去除了原本必须依赖配置文件才能使用的。
现在的功能只能依赖内存来作缓存,修改常量来影响缓存行为。
但是不依赖配置文件,可以很达到简单的融入自己的框架。
由于昨天没时间测试迁移的代码,所以没有发布代码
目前只支持 AbsoulteTime SlidingTime NeverExpire方式的,至于FileDependency的需要自己集成一个Action,所以没做测试,也没去研究移植后的代码是否可行。
http://files.cnblogs.com/wildfish/Caching.rar
今天测试了一下,觉得没什么问题。
顺便发布了测试代码

using System;
using System.Data;
using NUnit.Framework ;
using FishSky.SystemFrameWork.Caching;
using FishSky.SystemFrameWork.Caching.Expirations;
using FishSky.SystemFrameWork.Base;
using FishSky.Data.Base ;
using System.Threading;
namespace FishSkyTest.SystemFrameworkTest
{
    
/// <summary>
    
/// CachingTesting 的摘要说明。
    
/// </summary>

    [TestFixture]
    
public class CachingTesting
    
{
        
private CacheManager manager=CacheFactory.GetCacheManager();
        
private static string KeyWordToStore1="KeyWordToStore1";
        
private static string KeyWordToStore2="KeyWordToStore2";
        
private static string KeyWordToStore3="KeyWordToStore3";
        
private static string KeyWordToStore4="KeyWordToStore4";

        
public CachingTesting()
        
{
        
        }


        
SetUp

        
TestTimeSpanCacheAddRemove

        
TestAbsoluteTime

        
TestNeverExpired
    }

}

抱歉!评论已关闭.