On 10/24/2018 11:08 AM, Lukas Eder wrote:
On Sat, Oct 20, 2018 at 5:43 PM Marshall Pierce <[email protected]
<mailto:[email protected]>> wrote:
Perhaps each Record might keep a reference to its parent Result and
access some shared cache of field data? If that's not convenient,
though, I'd be totally fine if there was some other way to make
caching explicit (though it would be a shame to lose caching for all
users transparently), like having Result provide a
CachingRecordWidget that had some recordInto(Record, Table) method
that would then make it trivial to cache the necessary metadata.
That would scratch your immediate itch but is generally a not a good
idea as records are independent entities and could be placed in several
results. One example is the Result.intoGroups() method, which tends to
wrap sub-results in a Map. Other examples are methods like DSL.values(),
which have overloads accepting a Result, which might be constructed
using DSLContext.newResult().
This definitely looks easier at first than it really is. Any record can
be mapped into any other record type, including a Table reference, which
may or may not be generated. Blindly caching all these calls would blow
up cache sizes in some systems.
Of course, for large data sets, perhaps the built-in jOOQ mapping
methods might just not be good enough, and you can do easily better,
knowing exactly what you're doing given a particular use case.
Gotcha. Not surprising that there are 470 overloads I don't know about
yet in jOOQ that make it complex to automatically cache, but is it at
least feasible to opt in to caching so that a consumer could use it when
they're always looking up the same way (as I am)? Perhaps a
.cachedSomethingOrOther() that returns another Result -- that transient
object would be convenient to GC if it's only used in a loop, for instance.
--
You received this message because you are subscribed to the Google Groups "jOOQ User
Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.