Practical .NET Data Access Layer - 18

zhaozj2021-02-16  53

Talking about some implementation, for a few questions:

(1) Performance Problem: Cache Management can significantly increase data access efficiency, but the memory requirements are relatively high, especially in the application environment of the Web Application or Remoting Server!

So, this requires us to use "money" on the "blade" (except for the inner J), can't spend money!

Generally, for system data (such as application / module, group / user / permissions, etc.) or Lookup Data (such as marital status), you can consider adding cache; additionally, if customers (please pay attention: not Developers!) Think of the Business Data that is less likely or less frequent, can also consider adding Cache;

(2) Manual refresh: cache also adds troubles while bringing convenience. "Manual refresh data" may be the most troublesome thing!

In the system commissioning phase, we can also close the Cache function (

Remove the relevant content in the information) to avoid this problem, once on the line,

It can only be solved in other ways!

Here, the author first tries to give three solutions:

i. For web application, you can use the Dependency mechanism provided by .NET Framework to bind Cache to the file system. Once the data changes, only the relevant files or directory information can reach the Cache Refresh purposes (do not comply with the Ease of USE standard L) ! But for Windows Application, Dependency needs to implement L

II. You can use Observer Pattern to register all Data Access Logic updates. Once the update method is called, do the relevant delegate immediately to update Cache Data!

This may be a friendly solution for customers (there is a restriction

Condition: Customers cannot directly modify Database data J), but

The person is a endless "torture" (all day, hanging, total

Worried about the registration L)!

Iii. To achieve a UI, refresh management for Cache Data! This is a compromise between the two methods. It is also a kind of thinking of the author (of course, if a friend is interested in achieving the above 3 story and organically integrate, then merits. J).

Finally, in the author's Cache section configuration information for reference:

DistributionType = "remove" cacheItem = "allcustomers" />

priority = "high" />

Next paragraph: http://www.9cbs.net/develop/read_article.asp? Id = 27562

转载请注明原文地址:https://www.9cbs.com/read-24090.html

New Post(0)