I want to design a complete Buffer Solution ProgramBuffer data from various locations.
Application-level cache and application.
The user can understand session-level sessions, or not to mention
I want to talk about a smaller scope of application.
Thread level: cache that is valid only within a thread. For example, you can define a database connection object and buffer it at the Thread level. When performing various database operations, you don't have to worry about conflicts, because the current CPU only has one thread to execute. Our general approach to database connection is to declare a database connection within each object or pass it as an attribute outside the object. I think this approach is inconvenient. If we can achieve the line level, the cached database connection can be directly used within each data object in the data layer, without conflict, and the database connection is used to the maximum extent.
Request level: a cache that is valid only for a specific request. Sometimes, we all want to connect to the database once when the program is used. This request is always used to end. This is the request level.
I think the line level is better than the request level, because ASP. net is processed in this way. When a request is received, a thread is dispatched from the thread pool to process the request, and an httpapplication instance is also taken from the httpapplication instance pool for processing. Therefore, A thread can be used for multiple requests. An httpapplication instance may also be used for multiple requests.
After half a month of searching for information, I have already solved most of the problems, which are quite troublesome.
Now I want to hear from you and see if you have any better implementation methods.
Csdn address
Http://community.csdn.net/Expert/TopicView3.asp? Id = 5147435