Caching the objects is good practice. When data is retrieved from database server then objects are created. Creating an object is activity that takes time and resources. Some objects are very expensive to create. That's why caching takes place in BLL and not
in DAL. DAL deals only with data management,
Don't forget to mark solution providing post as "Answered".
The data layer is a mechanism to talk to the database and not used for business stuff. Hence you would cache the collection of business objects, like News Articles, in the business layer. The business layer uses the DAL to talk to the data store and it manages
any business related rules. The DAL and UI layers are very simple in relation to the business layer.
What if you have a very large query result in the DAL, and you want to retrieve subsets of this data in the BLL? Can you store the raw query result in cache in the DAL (and possibly give it a CacheKeyDependency, similar to the property of a SqlDataSource)?
Then retrieve subsets of this cached data in the BLL?
MuhammadKaMu...
Member
27 Points
76 Posts
Enable Cache in DAL
May 24, 2008 05:21 AM|LINK
I have found the properties related to caching in DataAccess Class.
But the caching in not used in DAL Classes and used in BLL Classes.
So can any one tell me why the author creates them in the root class of DAL.
DigiMortal
Contributor
5658 Points
939 Posts
MVP
Re: Enable Cache in DAL
May 24, 2008 07:56 AM|LINK
Also visit my ASP.NET blog or follow me @ Twitter:twitter.com/gpeipman
MuhammadKaMu...
Member
27 Points
76 Posts
Re: Enable Cache in DAL
May 24, 2008 09:22 AM|LINK
Sir, I know the caching is good and apply in BLL.
MuhammadKaMu...
Member
27 Points
76 Posts
Re: Enable Cache in DAL
May 26, 2008 04:17 AM|LINK
The question is that why the author used caching properties in DAL because he already used in BLL
docluv
Star
12685 Points
2005 Posts
ASPInsiders
MVP
Re: Enable Cache in DAL
Jun 23, 2008 02:34 PM|LINK
The data layer is a mechanism to talk to the database and not used for business stuff. Hence you would cache the collection of business objects, like News Articles, in the business layer. The business layer uses the DAL to talk to the data store and it manages any business related rules. The DAL and UI layers are very simple in relation to the business layer.
rwilson513
Member
58 Points
40 Posts
Re: Enable Cache in DAL
Mar 10, 2011 04:06 PM|LINK
What if you have a very large query result in the DAL, and you want to retrieve subsets of this data in the BLL? Can you store the raw query result in cache in the DAL (and possibly give it a CacheKeyDependency, similar to the property of a SqlDataSource)? Then retrieve subsets of this cached data in the BLL?