LINQ to SQL repository - caching data
Posted
by creativeincode
on Stack Overflow
See other posts from Stack Overflow
or by creativeincode
Published on 2010-05-12T09:40:11Z
Indexed on
2010/05/12
9:44 UTC
Read the original article
Hit count: 323
I have built my first MVC solution and used the repository pattern for retrieving/inserting/updating my database.
I am now in the process of refactoring and I've noticed that a lot of (in fact all) the methods within my repository are hitting the database everytime. This seems overkill and what I'd ideally like is to do is 'cache' the main data object e.g. 'GetAllAdverts' from the database and to then query against this cached object for things like 'FindAdvert(id), AddAdvert(), DeleteAdvert() etc..'
I'd also need to consider updating/deleting/adding records to this cache object and the database.
What is the best apporoach for something like this?
My knowledge of this type of things is minimal and really looking for advice/guidance/tutorial to point me in the right direction.
Thanks in advance.
© Stack Overflow or respective owner