A cache is always caching information not replacing your database, so
the first time it will have to get things from the database no matter
what caching you have enabled. Subsequent calls will utilise the 1st
and 2nd level caches if the item has been used before. Caching does
not work magic on your initial load. What I tend to do is during the
initialization phase of my Windows.Forms app I query all lookup tables
once so that their information is in the 2nd level cache. After this
any new session will tend to get the object information from the 2nd
level cache (syscache in my case). Query caches only help when you
call the same query loads of times with exactly the same parameters.
The cache will not store the info of these objects though, unless you
have set the returned class to also be cached. Hope this answers (part
of) your question

On Mar 10, 11:26 am, Harold Wanyama <[email protected]> wrote:
> Hi Jason,
> 1.Iam using Syscache implementation on a windows based application.
> 2.The startup code is created in its own library (Utilities) (thats where I
> created my NHibernateHelper sealed class .
> 3.Iam caching both entities and queries.
>
> Maybe my question is a bit misleading. My understanding of a cache is data
> storage in memory. My problem is how can I cancel the delay of querying the
> database teh first time my application starts up as the query hasn't yet
> been cached?
> Thanks
>
> On Tue, Mar 9, 2010 at 4:38 PM, Jason Meckley <[email protected]>wrote:
>
>
>
> > 1. what cache implementation are you using?
> > 2. where is the "startup" code located?
> > 3. are you caching entities, queries or both?
>
> > "on first time loading I am unable to implement 2nd level cache and
> > the performance lag is obvious to see."
> > could you clarify. cache, by definition, will expire periodically.
> > Therefore there will be times when the database is queried.
>
> > On Mar 9, 4:43 am, Harold Wanyama <[email protected]> wrote:
> > > Hi guys, I have so far been able to use 2nd level cache and it works fine
> > > albeit with one problem. When the application starts, and I query a list
> > of
> > > obects from the database, on first time loading I'am unable to implement
> > 2nd
> > > level cache and the performance lag is obvious to see. But on 2nd time
> > > loading and onwards 2nd level cache is used and the speed is much faster.
> > > How can I solve this problem? I can rephrase by saying If I create a
> > > persistent object , how can I cache it ??
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected]­>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to