How can I implement my caching mechanism in LLBL?

Posts   
 
    
BringerOD
User
Posts: 70
Joined: 15-Jul-2006
# Posted on: 16-Jul-2006 21:50:04   

How can I implement my caching mechanism in LLBL?

Currently I can cache any call to the database, entity, view, stored procedure. Basically it takes the name of the entity, view, or stored procedure, then adds the parameters AND there values into a key string, then inserts that into a cache. Currently the cache I use is the one in the Enterprise Library.

I can also do some filtering and query with grouping, its not as sophisticated as LLBL, but it works for me.

The main outcome was for me to shove all my data access through this one pipe, of which I could control the caching in a consistent manner. Web sites need a lot of caching ?

Can we do this with EntityCollections or some other mechanism?

Here is an example of code the we use to cache.

The “da” object is our main dataaccess object. It takes the params and puts them into a key with the values so we can cache if we want to. We can set the time we want it to stay in there as well.

    

 Public Function FillLocalizedControlsBase(ByVal lApplicationObjectID As Long, ByVal lLanguageObjectID As Long, _
        ByVal lContainer As String, ByVal lControlName As String, Optional ByVal cacheLen As EnumCachedLength = EnumCachedLength.High) As Integer

         With dparms
            .Clear()
            .Add("ApplicationObjectID", SqlDbType.BigInt, 8, lApplicationObjectID)
            .Add("LanguageObjectID", SqlDbType.BigInt, 8, lLanguageObjectID)
            .Add("Container", SqlDbType.NVarChar, 250, lContainer)
            .Add("ControlName", SqlDbType.NVarChar, 100, lControlName)
         End With

         Return da.InitAndFillTypedDataset(Me, tableLocalizedControlsBase, dparms, cacheLen, "Position ASC")

      End Function