views:

55

answers:

2

How can i read/write to the cache for a periode of time i.e 10 seconds and then commit the changes to the database?

A: 

The changes you make will be committed to the database upon the transaction commit independent of whether they were cached or not. As such, you'd need to avoid committing the transaction for that period of time.

btreat
+2  A: 

I'm not 100% sure for NHibernate but Hibernate 2nd level cache does NOT offer Write-Behind caching, Hibernate just directly writes to the database. I think the same applies to NHibernate. In other words, what you'd like to do is IMO not possible, at least not without modifying NHibernate to write to the 2nd level cache and a persistent async-database-queue. But that would be a really non trivial change and is not going to happen short term.

Pascal Thivent
The NHibernate 2nd level cache behaves the same way as the Hibernate one.
Sean Carpenter
@Sean Thanks for confirming this.
Pascal Thivent