MVC 使用缓存
public AController()
{
ViewBag["Class"] = GetClass();
} private List<BlogsClass> GetClass(int parentId)
{
List<BlogsClass> list;
//查询出分类 尼玛每次都得查,很烦! 有木有? 考虑缓存 if (HttpContext.Cache["Class"] == null)
{
IClass _Class = new CalssData();
list = _Class.GetParentClass(parentId);
HttpContext.Cache.Add("Class", list, new CacheDependency(HttpContext.Server.MapPath("~/web.config")), DateTime.Now.AddDays(), TimeSpan.Zero, CacheItemPriority.High, null);
HttpContext.Cache["Class"] = list;
}
else
{
list = HttpContext.Cache["Class"] as List<BlogsClass>;
}
return list;
}
结果。。。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmcAAAFJCAIAAABRnh2dAAAgAElEQVR4nO2du3HjvteG0cmWsCX8M6e/kE24iE08CLcEhSzAyYZfxmRntgyWwS+gROJyzsGhSNuU9TzzjkemQNwI4RUupMJ0Wsbxq3PwEYzTcEi5hmm4OwunrNi+/+ocAAC0CcKxsZ9CmEKY4jBN0zTE6799q7edQ3Z599d319PnXj6GKYQpREfehjUPLsap80S7BHaUaM78HGzQc7Kpx5/j3FAukcFdjQXj1CWXI4syujJW1sNwq0bFyF2VMxenm+4x9HHq84SHfo2nyO0QrW8bQ5SrdP5ELK0lmlkVv5RolTD27UYIAGdCcs1psbq5B7n1s83+NErmOh+8WungNeCZuR/3diu3fG6Q4joxCdP11y5vsX9R3RbjHKLU7W4ahg5baqY6Uba3zhWnWA/9uF5cQS077DvdrhzfDKKU6KDlVs9MVC7l2GdnRfuzIF0aMYdFVgHgEVBccxluzp/n63DT7r/E4cIgxZOHMcZw0yD0cXMkwknK8LHvJEuTzGMZVQ/SWXI8es8+9rqV1gZ5s3yvEd7rmkNUevxx6nwj4KIehph9JSojGKeu6QpzWXrVVJrfSGJeFem/fZcVyjI8vQa2uabURLVTtEYFAGdFcc2pGDgO7S/F4vRscVCcnFy8aqvEDnqPa9pn3eGaxtgrduWROeN99M1SbnTNZdowjT/9vlIYg8E212zV8xxhjOo18hj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djXt2PD5KPjUZril9oGY3Gt9i/2eIIQ5/+s7+3Gn106oHa5DqqJ/CNVfzttKVfM4I73BNttE+q87jmmkLznaTDzHUfRNf9B5I8oLZhjs6qrYhXX3t9872/A7ao+RTkTZDqznTJYbXvn+9jjvja/OOfqV+WvVgTu226yd1zfGty9NS0xVGxlb4O3cDPfWe6mfR17pmdhd8PheUTkYVDRHXfBRZTzlIdzbeOqAq/K2bSwK/9P06Jkg3WBZbOdTpwY16lHxq9S+5ZlWE1E3XtU9XlqT60epBrbdt9ZNPq6b9hlb/VWyN67WkIk9Qy4P1a+n4gfdvryNdc2mSX14qhBDaKWH37/TXmrzNn/mAvqv4pTCEEBIlTGXrM7fpSB19Z+Ga6MklbEytp/7Qs8r39Pb55nIs8zmEayKEEEJe4ZoIIYSQV7gmQggh5BWuiRBCCHmFayKEEEJe4ZoIIYSQV7gmQggh5BWuiRBCCHmFayKEEEJe4ZoIIYSQV7gmQggh5JXmmgAAAFCCawIAAHjBNQEAALzgmgAAAF5wTQAAAC+4JgAAgBdcEwAAwAuuCQAA4AXXBAAA8IJrAgAAeME1AQAAvOCaAAAAXnBNAAAAL7gmAACAF1wTAADAC64JAADgBdcEAADwIrtmCCGEsLwQ0U5RUwrh58+f/vAAAABn4/8Bwug+t3zF2iYAAAAASUVORK5CYII=" alt="" />
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
//Add the ActionResult to cache
List<BlogsClass> list;
if (filterContext.HttpContext.Cache["filterContext"] == null)
{
IClass _Class = new CalssData();
list = _Class.GetParentClass();
filterContext.HttpContext.Cache.Add("Class", list,
null, DateTime.Now.AddDays(),
System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.High, null);
}
else
{
list = filterContext.HttpContext.Cache["filterContext"] as List<BlogsClass>;
} //Add a value in order to know the last time it was cached.
//filterContext.Controller.ViewData["CachedStamp"] = DateTime.Now; ViewBag["Class"] = list;
base.OnActionExecuted(filterContext);
}
参考:http://www.codeproject.com/Articles/33431/ASP-NET-MVC-Result-Cache
MVC 使用缓存的更多相关文章
- [置顶]
MVC输出缓存(OutputCache参数详解)
1.学习之前你应该知道这些 几乎每个项目都会用到缓存,这是必然的.以前在学校时做的网站基本上的一个标准就是1.搞定增删改查2.页面做的不要太差3.能运行(ps真的有这种情况,答辩验收的时候几个人在讲台 ...
- MVC输出缓存(OutputCache参数详解)
版权声明:本文为博主原创文章,未经博主允许转载随意. https://blog.csdn.net/kebi007/article/details/59199115 1.学习之前你应该知道这些 几乎每个 ...
- Mvc 页面缓存 OutputCache VaryByCustom
优化网站,dotNet MVC 可以通过(OutputCache)特性在某些Action上使用缓存,如果我们想要自定义缓存依据可以通过如下方式进行: 第一步, 在 global.asax.cs 文件中 ...
- ASP.NET MVC编程——缓存
Web缓存分为服务端缓存和客户端缓存. 1 服务端缓存 1.1请求域内的缓存:HttpContext.Items 类型: HttpContext.Items的类型为IDictionary,且键和值都是 ...
- MVC -18.缓存(2)
一.MVC缓存简介 缓存是将信息(数据或页面)放在内存中以避免频繁的数据库存储或执行整个页面的生命周期,直到缓存的信息过期或依赖变更才再次从数据库中读取数据或重新执行页面的生命周期.在系统优化过程中, ...
- MVC 之 缓存机制(二)
八.应用程序缓存 应用程序缓存提供了一种编程方式,可通过键/值对将任意数据存储在内存中. 使用应用程序缓存与使用应用程序状态类似. 但是,与应用程序状态不同的是,应用程序缓存中的数据是易失的, 即数据 ...
- MVC 之 缓存机制(一)
一.概述 缓存是将信息(数据或页面)放在内存中以避免频繁的数据库存储或执行整个页面的生命周期,直到缓存的信息过期或依赖变更才再次从数据库中读取数据或重新执行页面的生命周期.在系统优化过程中,缓存是比较 ...
- ASP.NET MVC 3:缓存功能的设计问题
今天这一篇文章我来谈一谈在MVC 3项目中的缓存功能,以及针对缓存的一些设计上的考量,给大家参考参考. 为什么需要讨论缓存?缓存是一个中大型系统所必须考虑的问题.为了避免每次请求都去访问后台的资源(例 ...
- 使用maven简单搭建Spring mvc + redis缓存
注:此文参考并整合了网上的文章 <spring缓存机制>:http://blog.csdn.net/sidongxue2/article/details/30516141 <配置 S ...
- java mvc 及其缓存
使用Spring框架的好处是什么? - 轻量:Spring 是轻量的,基本的版本大约2MB. - 控制反转:Spring通过控制反转实现了松散耦合,对象们给出它们的依赖,而不是创建或查找依赖的对象们. ...
随机推荐
- Nginx模块 ngx_http_limit_req_module 限制请求速率
The ngx_http_limit_req_module module (0.7.21) is used to limit the request processing rate per a def ...
- 20172328 2018-2019《Java软件结构与数据结构》第八周学习总结
20172328 2018-2019<Java软件结构与数据结构>第八周学习总结 概述 Generalization 本周学习了二叉树的另一种有序扩展?是什么呢?你猜对了!ヾ(◍°∇°◍) ...
- 2018.我的NOIP补全计划
code: efzoi.tk @ shleodai noip2011 D1 选择客栈 这道题是一道大水题,冷静分析一会就会发现我们需要维护最后一个不合法点和前缀和. 维护最后一个不合法点只要边扫描边维 ...
- Anaconda介绍、安装及使用教程
https://www.jianshu.com/p/62f155eb6ac5 Anaconda介绍.安装及使用教程 Python是一种面向对象的解释型计算机程序设计语言,其使用,具有跨平台的特点,可以 ...
- [模板][题解][Luogu1939]矩阵乘法加速递推(详解)
题目传送门 题目大意:计算数列a的第n项,其中: \[a[1] = a[2] = a[3] = 1\] \[a[i] = a[i-3] + a[i - 1]\] \[(n ≤ 2 \times 10^ ...
- js 执行顺序
同步任务 异步任务 同步任务:立即执行 异步任务:进入到异步队列当中(Event Queue)eg:Ajax,SetTimeout,then,SetInterval Event loop 事件循环 T ...
- SPARK-18560
##### Receiver data can not be dataSerialized properly. ``` // :: ERROR executor.Executor: Exception ...
- css学习_css3伸缩布局 flex布局
1.flex布局 案例一: 案例二: 保证不至于缩放得太小或太大 案例三:flex的值不一定要写成几份,可以写成固定值 案例四: 竖着3等分(父容器按照高度3等分) !!案例 -----用fle ...
- spring boot异常积累
1.异常:Error resolving template "xxx", template might not exist or might not be accessible.. ...
- 学习STM32单片机,从菜鸟到牛人就是这样简单(配视频资料)
我想说,为了学习单片机而去学习单片机的思路不对. 你问,如何系统地入门学习stm32? 本身就是一个错误的问题.假如你会使用8051 , 会写C语言,那么STM32本身并不需要刻意的学习. 你要考虑的 ...