-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Prevalence 2nd level cache doesn't support object expiry?
PostPosted: Fri Apr 07, 2006 1:43 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
NHibernate version: 1.0.2

I've just started looking into caching to improve performance on the framework I'm working on. The framework is being used in both web and non-web environments which will be concurrently sharing the same back-end DB.

Because of the fact that one instance of the framework could update the database without another instance's knowledge I need to have some sort of expiry to ensure that even objects that aren't updated by the local instance will periodically get a fresh copy from the DB.

Since the framework is being used in both web and non-web environments the ASP.NET cache doesn't look like the best fit, however I haven't been able to find any sort of expiry system on the Prevalence implementation.

Am I missing something, or can I just not provide caching for the non-web consumers of my framework?

Hope someone out there has an answer for me...

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 07, 2006 2:48 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Prevalence doesn't have an expiry feature, but the SysCache thing should work for you. We use the HttpRuntime.Cache from everywhere - WinForms apps, asp.net apps, COM/ASP apps - I'm not saying it's a great idea, but it works. ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 07, 2006 6:40 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Oh, OK. I figured that the SysCache wouldn't be available when not used in a web app...thanks for the tip!

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 07, 2006 7:02 pm 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Actually, I have another question on this subject...in SysCache you can set expiry only on a region - how do you specify which objects go into which regions?

I was hoping to be able to specify that particular classes are only cached for a short time while others would be cached for longer, but I have to admit that I'm really a bit confused as to how all this works...

Anyone got any pointers?

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 08, 2006 10:55 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
http://www.hibernate.org/hib_docs/nhibernate/html/caches.html


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 08, 2006 10:56 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
http://www.hibernate.org/hib_docs/nhibernate/html/caches.html


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 08, 2006 10:57 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Sorry, forum not responding.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 09, 2006 3:47 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Thanks k-dub, I've read the documentation. My confusion is that there appears to be only one expiration for *all* classes, rather than per class. Also that the SysCaches has an expiry for a cache region, but there's no way to apply a cache region to a class.

Is there any way to set particuar expiries for specific classes?

Since some of my classes are read only or have low concurrency I want them to have long cache lifetimes, while others have medum-high concurrency but may be changed by another process that NHibernate is not aware of, so I want them to have short cache lifetimes.

Is there any way to accomplish this? The docs don't seem to indicate that I can, but sometimes there's more than meets the eye.

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 10, 2006 1:11 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
This is how to use EHCache in Hibernate. If NHibernate makes the same association between a class full (or partial) name and the known configured regions, then it should be the the same as EHCache in Hibernate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.