DoctrineMongoDBBundle icon indicating copy to clipboard operation
DoctrineMongoDBBundle copied to clipboard

Allow Symfony cache pool support

Open franmomu opened this issue 3 years ago • 2 comments

It would be nice to be able to use a Symfony pool directly as in https://github.com/doctrine/DoctrineBundle/pull/948

franmomu avatar May 23 '22 07:05 franmomu

Caching raw database results isn't a pattern that we want to promote.

A good MongoDB model design involves denormalizing documents to optimize usage. If you think a read cache is needed, it's probably because the model needs to be optimized for reading.

In specific cases where caching is necessary, it is often preferable to use your own overlay by formatting the cached data for the use case, rather than keeping it raw from MongoDB.

One concern with the cache layer on query results is that it is easy to work with outdated documents without realizing it. Documents are tracked in the UOW with outdated data.

Brief, I am opposed to this feature, which would add complexity without providing any real benefit.

GromNaN avatar Nov 14 '25 20:11 GromNaN

@GromNaN I believe the request is to allow configuring a cache pool directly, e.g. for the metadata cache. From what I can see, we have not yet ported this change to the Doctrine ODM (which we should).

alcaeus avatar Dec 18 '25 10:12 alcaeus