NHibernate Caching Problem - When to Call Hellyn?

I ran into an obvious caching issue when what NHibernate returns does not match what is in the database.

I believe this is level 2 cache data. It looks like I can use Evict to do this, but when should the Evict method be called? . For my particular application, the data will be unique to the user, and it is likely that the data provided will be used only once *.

Is it possible to completely disable level 2 caching for these sets of objects?

UPDATE 10/31

My scenario is this: I have a shopping cart where a customer is about to add and remove items. I do the following: before the basket updates are processed, I CartProduct Cart and CartProduct . Once this is done, I get the CartProducts list from the provider and return the view (this happens in the .NET MVC Controller).

UPDATE 11/3

The basket has since been completed, and I ran into a problem that appears to be related to the same NHibernate problem, but was actually an MVC problem. A deeper digging revealed that the HTML Helper extensions redefined the value I assumed and replaced what was in the state of the model. So a double blow to this. Hope this helps someone.

+4
source share
1 answer

No, you cannot disable the cache for certain objects.

You have several options:

+18
source

Source: https://habr.com/ru/post/1442885/


All Articles