In the PHP world, especially when using Symfony, Doctrine ORM is very popular (inspired by Hibernate). It has all kinds of caches, including the query cache that you mentioned: https://www.doctrine-project.org/projects/doctrine-orm/en/2....
Why bother caching queries that are pretty quick to generate? Most caching around ORMs focuses on caching the results of the query since they require more resources to generate.
Re:Is ORM still an anti-pattern?
by adamrezich on Tuesday June 27, 2023 @05:06PM
(#36498664)
well if you're using an interpreted language without any sort of build step then I suppose that's all you can do, but if your backend is written in a compiled language with compile-time execution functionality, then it seems useful to do stuff like this then, instead of at run-time, likely multiple times per request—that's a lot of unnecessarily repeated string-building, without any benefit for doing so!
Re:Is ORM still an anti-pattern?
by cjblomqvist on Tuesday June 27, 2023 @04:53PM
(#36498482)
Probably different for different ORMs. I know EF Core (C# /.NET) does it/cache queries (for performance reasons).
I've been wondering about this and other things while working on my own mini-ORM thing for SQLite—I have it so queries are built once, at compile-time, type-checked, and stored in read-only memory in the executable. but I'm going down the route of having the user manually write SQL for everything that isn't super basic, instead of making a sort of mini-DSL for query-building. so far it's been going great but there's a lot of prior art in this space, and while I've used both Rails and Django before, forever ago, I've been kind of going into this all blindly (and so far it's been going great!).