How to prevent concuurent users from adding data to cache

  • Thread starter Thread starter Jeenu
  • Start date Start date
J

Jeenu

I am using asp.net to build a scalable application.

I am using data caching and I want to know whether the following
situation can arise

If concurrent users check the cache and finds that data is not there
then they all will try to get the data from the database which is not
required .

I think this is a problem and need solve it
I want to know if there is a way to allow only one user to access the
database and add it to the cache while others wait and gets the data
from the cache. So the database acess is minimum
..
 
Unless you are loading all of the data into memory (thus reducing the need
for an actual RDBMS), the more efficient (and scalable) solution is to cache
according to what is requested. This means as a person (any person, not just
one) requests data, it is cached. ADO.NET provides the framework to
automatically cache certain bits of data. If you are using ASP.NET, you have
additional caching options. If these fits your needs, it is far more
maintainable than coding your own caching mechanism.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top