docs: Opt out of "Unit of Work caching" #4135
Replies: 1 comment 9 replies
-
You are asking for more docs and it feels like you haven't read the current ones :] https://mikro-orm.io/docs/installation#request-context
Feels like you are mixing identity map, result cache, and metadata cache, those are 3 different things. And yes, you need to bring your own cache adapters, MikroORM provides only one for memory (used for result cache) and one for JSON files (used for metadata cache). You can't configure the "identity map cache", that always lives in the memory, as that is tied to the EntityManager instance, you can't share it, it would break the change tracking. Note that the result cache is opt-in, you need to enable that on the call site, it is not enabled by default.
It does not have a |
Beta Was this translation helpful? Give feedback.
-
As @typeorm is sadly a dead project now, I was looking for other ORMs in the nodejs world and found Mikroorm.
In the docs I saw, that Mikroorm tries to return the entity from the cache (on second run) when queried by their primary key.
As nodejs are, compared to for example php scripts, long running processes, how does this behave if I have multiple nodejs processes/containers/servers running? If one process updates an entity and an other process/server queries for that entity and has it in his cache, then I am getting an outdated result. In the docs it says that you can specify your custom ResultCacheAdapter. I havent found a build in for Redis/Memcached, etc. Do I have to implement that by myself? Or is it best to completely disable the result cache (is possible?).
I found that MikroOrm has a RedisCacheAdapter, but it is listed under Metadata Cache, so it will not be used for Result Cache?
Thanks for answer and maybe the docs can be improved here a little bit. :)
Beta Was this translation helpful? Give feedback.
All reactions