Question: LLBLGenPro as a Caching Layer for the Database

Posts   
 
    
Vijay
User
Posts: 2
Joined: 06-May-2009
# Posted on: 06-May-2009 19:20:24   

Say I am using LLBLGenPro to retrieve some information from the database. Obviously in the first call, the SQL will hit the database and it will load the results into LLBLGenPro memory.

My question is that, for subsequent requests does it hit the database or does it hit the memory? – Like I requested 100 rows as part of a select, the next time I do the same select using LLBLGenPro syntax, and methods, will it hit the database?

Can LLBLGenPro be used as a caching layer between the database and the app server? – If so, how is this done?

Posts: 7
Joined: 26-Jul-2007
# Posted on: 07-May-2009 08:05:50   

Vijay wrote:

Say I am using LLBLGenPro to retrieve some information from the database. Obviously in the first call, the SQL will hit the database and it will load the results into LLBLGenPro memory.

My question is that, for subsequent requests does it hit the database or does it hit the memory? – Like I requested 100 rows as part of a select, the next time I do the same select using LLBLGenPro syntax, and methods, will it hit the database?

Can LLBLGenPro be used as a caching layer between the database and the app server? – If so, how is this done?

You definitely can use LLBGLGen as a caching layer, but I don't think it will do any of this work automagically for you.

Certainly by default, if you use LLBLGen to requery the DB, it will hit the database.

You may wish to have a look at PostSharp as an additional framework to fold caching patterns into your architecture.

Vijay
User
Posts: 2
Joined: 06-May-2009
# Posted on: 07-May-2009 18:56:48   

Without using any other framework, is it possible to ask LLBLGenPro to query the cached data instead of the database?

This is not about caching per se. It is the question of whether it is possible to run a query on the in-memory data objects of LLBLGenPro.

And ideally, I would want the in-memory querying syntax to be the same or very similar to regular LLBLGenPro queries.

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 07-May-2009 19:43:20   

Vijay - I am making VERY extensive use of in-memory filtering. Yes, it is completely possible.

Have you looked at Predicates in the manual? LLBLGen has many Predicate types that can be used in memory for Aggregate, Related Entities, etc. One of the most powerful Predicate types for in-memory filtering is DelegatePredicate. You have full control over what entities are filtered in/out.

I even have support for the user to filter the Collections themselves. They can build filters & create a Whitelist/Blacklist.

Take a look at the Help in the LLBLGen Designer... You will be pleasantly surprised!

Hope this helps!

Ryan