Fluent NHibernate asp.net MVC caching
Having problems with my ASP.NET MVC2 project. I'm using Fluent NHibernate as ORM, and I really like it. The problems that I have is with开发者_开发百科 caching(I think). I have for example a JQuery DataTable that is getting data with ajax from the database through a controller. The DataTable lists different stuff from the database, If I remove or add some posts, the data doesent seem to update, even if the calls are getting made and NHibernate does what it is supposed to do(I think).
The data only updates as it should If I rerun the project(programming locally), but sometimes even that doesent work.
Is caching the problem? Is it NHibernate caches or the browser?
If data is updated at the database and not through the application, nHibernate will not know about the data, and when queried for again by a List(), or Load() will not return to the database to acquire the full data set.
Suggestions here are:
- For this testing create some means of putting data in the database via nHibernate
- Or whilst in a testing stage, have the service method that is being called by jQuery Clear the cache each time, thus forcing nHibernate back to the database with each request.
This can be done completely using ISession.Clear(), or the known objects could be evicted using Evict().
Not really a go-live option though because it is advantages to have nHibernate caching data.
精彩评论