Visit | Data to talk about implementation issues, to say a few digression:
(1) Performance problem: Cache management can significantly improve the efficiency of data access, but the memory requirements are higher, especially in the Web application or remoting server such an application environment!
Therefore, this requires that we should use the "money" on the "Blade" (except for memory without care of the other J), can not spend money!
Generally, for system data (such as: application/module, group/user/permissions, etc.) or lookup Data (such as: marital status enumeration/political appearance enumeration, etc.), you can consider putting cache; Also, if the customer (Please note: not a developer!) It is considered that the business data with less change possibility or less frequency may also be considered into cache;
(2) Manual refresh: The cache is a double-edged sword, bringing convenience at the same time also add annoyance. "Manually refreshing data" may be one of the most troublesome things!
In the system debugging phase, we can also by turning off the cache function (in the matching
To avoid this problem by commenting out the relevant content in the message, but once online,
can only be solved by other means!
Here, the author first tries to give 3 solutions:
I. For Web application, you can use the dependency mechanism provided by the. NET framework to bind cache to a file system, and once the data changes, you need to update the relevant file or directory information to reach the cache Refresh purpose (not conforming to ease of Use standard L)! But for Windows application,dependency, you need to implement the L
II. You can use observer pattern to register all the Data Access logic update operations, and once the Update method is invoked, execute the related delegate immediately to update the cache data!
This may be one of the most user-friendly solutions for customers (there is a limit
Condition: Customer cannot directly modify database data J), but
The hair of the staff is an endless "torture" (fear all day, always
Worry about forgetting to register L)!
Iii. implement a UI to refresh the cache data management! This is a compromise between the above two methods, but also a way of thinking of the author (of course, if a friend is interested in the above 3 kinds of all to achieve and organic integration, then boundless beneficence j).
Finally, the author's machine on the cache part of the configuration information for you to refer to:
<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<dafConfiguration>
<dal>
<class name= "Customerdal_orm" >
<method name= "Getallcustomers"
Distributiontype= "REMOTING"
cacheitem= "AllCustomers"/>
</class>
</dal>
<cache>
<group name= "Business" >
<item name= "AllCustomers" >
<webapp absoluteexpiration= "12.0,hour"
priority= "High"/>
<winapp accesscount= "2"/>
</item>
</group>
</cache>
</dafConfiguration>
</configuration>
Next paragraph: http://www.csdn.net/develop/Read_Article.asp?id=27562
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.