On Apr 9, 5:37 am, FrancK <[email protected]> wrote:
> I'm using NH2 with Syscache (with some cache region in app.config)
> Is there a way to change programmatically the expiration of some region ?
Given how the cache factory works, you can't set new values for cache
properties after it is created by configuration. You might change the
Configuration object and recreate the SessionFactory, but that would
be a heavy task...
A method I use to clear a whole cache region (not tested with
SysCache) is:
public static void ClearCacheRegion(ISession session, String
regionName)
{
var properties = new Dictionary<String, String>();
session
.SessionFactory
.Settings
.CacheProvider
.BuildCache(regionName, properties)
.Clear();
}
> Moreover how can I refresh some cached objects ?
To remove objects from second-level cache, use some of the
ISessionFactory.Evict*() methods. For details, see:
http://nhforge.org/doc/nh/en/index.html#performance-sessioncache
http://nhforge.org/doc/nh/en/index.html#performance-querycache
Regards,
Ricardo Stuven.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---