|  | CYQ.Data componentsCYQ.Data support multi-database application  [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project | 
CYQ.Data 数据框架 缓存使用帮助
| Guide |
										
										|
										
										| | #TopicOwner | 
| 本节介绍CYQ.Data.Cache,缓存的相关使用方法: 一:缓存操作 1:缓存对象定义: public CYQ.Data.Cache.CacheManage cache=CYQ.Data.Cache.CacheManage.Instance; 2:缓存添加 方法原型: public void Add(string key, object value) public void Add(string key, object value, string filePath) public void Add(string key, object value, string filePath, double cacheTimeMinutes) 示例: cache.Add("newObj",new UserInfo());//缓存一个实体类 cache.Add("htmlObj",document,Server.MapPath("a.html"));//缓存html,并设置文件依赖 cache.Add("userObj",UserInfo,null,5);//缓存用户信息,5分钟。 3:缓存获取 方法原型:public object Get(string key) 示例: UserInfo info=cache.Get("newObj") as UserInfo; 4:缓存更新 方法原型: public void Update(string key, object value) public void Set(string key, object value) 示例: cache.Update("newObj",new UserInfo());//如果存在缓存项,则更新对象 cache.Set("newObj",new UserInfo());//如果存在缓存项,则更新对象,不存在,则添加 5:缓存删除 方法原型: public void Remove(string key) public void Clear() 示例: cache.Remove("newObj");//删除缓存的实体类项 cache.Clear()清除所有缓存项 6:自定义缓存标识 方法原型: public void SetChange(string key,bool change) public bool GetHasChanged(string key) 示例 cache.SetChange("newObj",true);//标识一个缓存项被更改过。 bool beChanged=cache.GetHasChanged("newObj");获取到标识被更改过。 作用示例: 比如在某文章中,该文章被缓存,用户编辑了一下,此时可设置标识位,该缓存被修改过,但不调整页面缓存。等页面有用户浏览时,根据标识再进行处理。 二:缓存管理(V5.0以上功能) 1:获取所有缓存信息: Dictionary<string, CacheDependencyInfo> infoList = cache.CacheInfo; 2:打印缓存信息示例:         private string row = "<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td style='text-align: left;'>{5}</td></tr>"; 打印缓存效果: 
 
  | |
Post Comment
Bulletin
Article Search
Categories
- Platform for dynamic (20)
- Feedback (9)
- Guide (33)
- Principles (19)
- Project-Case (8)
- Business & Buy (2)
- Technology exchange (45)
New Article
- CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
- CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
- CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
- CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
- CYQ.Data Components Getting Started Guide [Part 1]
New Comment
- When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here.
- This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
- I truly appreciate this blog article.Really thank you! Cool.
- please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
- Really enjoyed this post.Really thank you!
- Really enjoyed this article.Really looking forward to read more. Great.
- poker bonuses What are the norms of copyright of web content? How as it different from Patent?
- Wow! Thank you! I permanently needed to write on my blog something like that. Can I implement a fragment of your post to my site?
- This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
- I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.


