反正是有缓存功能/法在C# [英] Is there anyway to cache function/method in C#
本文介绍了反正是有缓存功能/法在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我厌倦了写相同的,以code连连缓存中的数据访问层的对象。
I got bored with writing same to code again and again to cache the objects in data access layer.
反正是有缓存的C#函数的结果没有太大的改变功能。
Is there anyway to cache c# function results without much changes to functions.
有任何框架支持此功能的时刻?
Is there any framework supports this functionality at the moment?
我可归档相同的通过编写自定义的C#的功能属性?如果是的话,请给我一些要点开始实施?
Can i archive the same by writing custom "c# function attributes"? if so, drop me some points to start implementation?
推荐答案
您可以创建 PostSharp 的缓存属性。 这里就是一个例子。
You can create caching attributes with PostSharp. Here is an example.
这篇关于反正是有缓存功能/法在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文