zoukankan      html  css  js  c++  java
  • 缓存依赖性dependencies

    CacheDependency fileDependency=new CacheDependency(Server.Mappath("NorthWind.xml"));
    Cache.Insert(
    "GridViewDataSet",dsGrid,fileDependency);


    string[] fileDependsArray = {Server.MapPath("Northwind.xml")};
                 
    string[] cacheDependsArray = {"Depend0""Depend1""Depend2"};
                 CacheDependency cacheDepends 
    = new CacheDependency
                                       (fileDependsArray, cacheDependsArray);
                 Cache.Insert(
    "GridViewDataSet", dsGrid, cacheDepends,
                                DateTime.Now.AddSeconds(
    10),
                                    Cache.NoSlidingExpiration,
                                    CacheItemPriority.Default,
                                    onRemove);
    Cache.Insert(参数)

    参数

    key

    用于引用该对象的缓存键。

    value

    要插入缓存中的对象。

    dependencies

    该项的文件依赖项或缓存键依赖项。当任何依赖项更改时,该对象即无效,并从缓存中移除。如果没有依赖项,则此参数包含 空引用(在 Visual Basic 中为 Nothing)。

    absoluteExpiration

    所插入对象将过期并被从缓存中移除的时间。如果使用绝对过期,则 slidingExpiration 参数必须为 NoSlidingExpiration

    slidingExpiration

    最后一次访问所插入对象时与该对象过期时之间的时间间隔。如果该值等效于 20 分钟,则对象在最后一次被访问 20 分钟之后将过期并被从缓存中移除。如果使用可调过期,则 absoluteExpiration 参数必须为 NoAbsoluteExpiration

    priority

    该对象相对于缓存中存储的其他项的成本,由 CacheItemPriority 枚举表示。该值由缓存在退出对象时使用;具有较低成本的对象在具有较高成本的对象之前被从缓存移除。

    onRemoveCallback

    在从缓存中移除对象时将调用的委托(如果提供)。当从缓存中删除应用程序的对象时,可使用它来通知应用程序。

  • 相关阅读:
    C#中upd分包与发送,已经实现全部代码
    Jmeter字体大小、背景色
    Linux查看日志 tail -f , grep
    xshell如何选中即复制,右键即粘贴
    Jmeter如何做接口测试
    Jmeter 线程数、ramp-up period (in seconds)、循环次数
    java反射机制入门01
    java实现文件夹(包括其中的子文件夹、子文件)的复制——递归
    ViewPager实现广告自动轮播核心代码(Handler+Thread)
    ViewPager实现启动引导页面(个人认为很详细)
  • 原文地址:https://www.cnblogs.com/zwl12549/p/875143.html
Copyright © 2011-2022 走看看