Entity Cache and Select By Id

I’ve enabled Entity Cache in my project and it appears to be working as defined. I’ve noticed the changes by watching SQL Profiler and can see where certain calls are being cached and not being called again. The exception to that is anywhere that I am explicitly attempting to load an entity by id using either EntityManager or DataManager, these seem to always go to the database. Is this the expected behavior? I have a couple of tables with not a lot of records that get hit all the time in controllers and the business layer and I don’t want them being called from the database each time. These records are also rarely modified. They both have varchar(max) fields so I don’t want these to be part of any other views. How can I cache these? Do I have to implement something myself? If so is there any examples or guidance I should be following?

Thoughts? Thanks.

Hi Josh,

This is not normal, the entity cache is always used when loading by id. See for example this test.
Could you reproduce the problem on a test project?

A bug was found in the system from another post of mine: https://www.cuba-platform.com/discuss/t/entity-cache-loads-one-at-a-time-issues/6510. After seeing that UUID entities have issues on SQLServer with caching I tested both lower-case and upper-case UUIDs with selecting by Id and it appears to be the same issue here as well.

The returned object is always the same in memory object, but searching on a lower-case UUID results in a database hit. If we can make sure this gets resolved with the other issue that would be much appreciated.

Thanks.