I am using the following technique to cache some calls to my database - this function lives in my repository.
Public Shared Function GetByStoreURL(ByVal StoreURL As String) As Model.Partner
Dim key As String = StoreURL
If Current.Cache(key) Is Nothing Then
Dim objPartner = Model.DB.Select().From(Tables.Partner).Where(Partner.Columns.StoreURL).IsEqualTo(StoreURL.ToString).And(Partner.Columns.IsDeleted).IsNotEqualTo(1).ExecuteSingle(Of Partner)()
Current.Cache.Add(key, objPartner, Nothing, Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(60), CacheItemPriority.NotRemovable, Nothing)
End If
Return DirectCast(Current.Cache(key), Model.Partner)
End Function
Is this technique flawed? seems so simple and looks like it has been working great.