当前位置: 首页>>代码示例>>C#>>正文


C# CacheManager.Insert方法代码示例

本文整理汇总了C#中CacheManager.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# CacheManager.Insert方法的具体用法?C# CacheManager.Insert怎么用?C# CacheManager.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CacheManager的用法示例。


在下文中一共展示了CacheManager.Insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     var cache = new CacheManager<string>("PigeonCms.HelloWord");
     if (cache.IsEmpty(this.BaseModule.Id.ToString()))
     {
         LitOutput = "This is an HelloWord module.<br />"
         + "Theese are the params you set for the module; <br />"
         + "your name: " + this.YourName + "<br />"
         + "gender: " + this.Gender + "<br />"
         + "age: " + this.Age.ToString() + "<br />";
         cache.Insert(this.BaseModule.Id.ToString(), LitOutput);
     }
     else
     {
         LitOutput = cache.GetValue(this.BaseModule.Id.ToString());
     }
 }
开发者ID:liqueflies,项目名称:pigeoncms,代码行数:17,代码来源:Default.ascx.cs

示例2: GetImages

        public ImageModel GetImages(string path)
        {
            var cachemanager = new CacheManager<ImageModel>("Images", 60 * 2); // 2 hours?
            cachemanager.Clear();
            var cached = cachemanager.Grab();
            if (cached == null)
            {
                var controller = path + "ImageModel.Json";
                if (FileTools.SFileExists(controller))
                    cached = JsonHelper.DeserializeFromFile<ImageModel>(controller);
                else
                {
                    cached = GetAllUnmangedImages(path);
                    FileTools.SWriteFile(controller, JsonHelper.Serialize(cached));
                }
                cachemanager.Insert(cached, CacheItemPriority.Normal);
            }

            return cached;
        }
开发者ID:Roballen,项目名称:Edge-Landscaping,代码行数:20,代码来源:ImageRepository.cs

示例3: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        var obj1 = new PigeonCms.Placeholder();
        var cache = new CacheManager<PigeonCms.Placeholder>("PigeonCms.Placeholder");
        if (cache.IsEmpty(this.Name))
        {
            obj1 = new PlaceholdersManager().GetByName(this.Name);
            cache.Insert(this.Name, obj1);
        }
        else
        {
            obj1 = cache.GetValue(this.Name);
        }

        LitContent.Text = "";
        if (obj1.Visible)
        {
            LitContent.Text = obj1.Content;
        }
    }
开发者ID:liqueflies,项目名称:pigeoncms,代码行数:20,代码来源:Placeholder.ascx.cs

示例4: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        var sp1 = new StaticPage();
        var cache = new CacheManager<StaticPage>("PigeonCms.StaticPage", this.CacheDuration);
        if (cache.IsEmpty(this.PageName))
        {
            if (!StaticPagesManager.ExistPage(this.PageName))
                this.PageName = StaticPagesManager.DEFAULT_PAGE_NAME;
            sp1 = new StaticPagesManager().GetStaticPageByName(this.PageName);
            cache.Insert(this.PageName, sp1);
        }
        else
        {
            sp1 = cache.GetValue(this.PageName);
        }

        if (sp1.ShowPageTitle) LitPageTitle.Text = sp1.PageTitle + "<br />";
        LitPageContent.Text = "";
        if (!sp1.IsPageContentTranslated)
        {
            //LitPageContent.Text += "<span class='textNote'>" + Resources.PublicLabels.LblTextNotTranslated + "</span><br />";
        }
        LitPageContent.Text += sp1.PageContentParsed;
    }
开发者ID:liqueflies,项目名称:pigeoncms,代码行数:24,代码来源:StaticPage.ascx.cs

示例5: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        CACHE_KEY = "Rows_Items";
        CachedList = new CacheManager<List<Item>>("AQ.CacheSample");
        List<Item> list;

        if (!Page.IsPostBack)
        {

        }

        if (CachedList.IsEmpty(CACHE_KEY))
        {
            LitRes.Text = "data from db";
            list = getList();
            CachedList.Insert(CACHE_KEY, list);
        }
        else
        {
            LitRes.Text = "data from cache";
            list = CachedList.GetValue(CACHE_KEY);
        }
        LitRows = renderRows(list);
    }
开发者ID:liqueflies,项目名称:pigeoncms,代码行数:24,代码来源:cache.aspx.cs


注:本文中的CacheManager.Insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。