• ASP.NET Cache使用


    抄的CS里的一段代码。

        protected override void OnInit(EventArgs e)
        
    {
            List
    <IndexPost> recentPosts = CSCache.Get("HomePageSearch-" + CurrentCSContext.User.RoleKey) as List<IndexPost>;
            
    if (recentPosts == null)
            
    {
                SearchQuery query 
    = new SearchQuery();
                query.StartDate 
    = DateTime.Now.AddDays(-10);
                query.EndDate 
    = DateTime.Now.AddDays(1);
                query.PageSize 
    = 5;

                recentPosts 
    = CSSearch.Search(query).Posts;
                CSCache.Insert(
    "HomePageSearch-" + CurrentCSContext.User.RoleKey, recentPosts, CSCache.MinuteFactor * 5);
            }

            RecentPostList.DataSource 
    = recentPosts;

            
    base.OnInit(e);
        }
  • 相关阅读:
    redis 数据类型详解 以及 redis适用场景场合
    angular.js记录
    Python chr() 函数
    Python frozenset() 函数
    Python 字典 dict() 函数
    Python set() 函数
    Python tuple 函数
    Python eval() 函数
    Python repr() 函数
    Python str() 函数
  • 原文地址:https://www.cnblogs.com/huang/p/1084826.html
Copyright © 2020-2023  润新知