« Return to Thread: caching query results for all queries...?
In addition to EclipseLink's object cache, EclipseLink also supports a query cache. There is the following distinction between the two:
The hint can be added to all queries. Obviously it will improve performance more for queries that are executed more often. (named queries are a good candidate here)
Queries are actually cloned before we apply query hints to them, so the SessionCustomizer option listed below may be what you want for certain queries. (since it will affect the query every time it is looked up rather than just the instance you get from em.createQuery()).
BTW: Some doc:
http://wiki.eclipse.org/Introduction_to_EclipseLink_Queries_(ELUG)#How_to_Cache_Query_Results_in_the_Query_Cache
-Tom
On 09/03/2012 8:49 AM, Tim Martin wrote:
Just to check - the hint can only be added to named ? not those built on the fly_______________________________________________
(which of course we are doing are best to avoid :)
On 09/03/2012 13:45, Tom Ware wrote:
There is no setting to do this universally for a whole persistence unit. It
should be possible to do this using EclipseLink-native API in a
SessionCustomizer by iterating through the queries defined in the query
manager and calling the required native API to set it up. The timeouts could
be set in the same code.
The reason there is no universal setting is that it is not clear that this
would be desirable in most use-cases. EclipseLink already has a cache that
provides quite a bit of performance boost and the query results cache is
intended to provide an additional performance boost for selected queries.
Using the query cache requires an understanding about the degree to which
results may be stale when they come back.
-Tom
On 09/03/2012 8:16 AM, Tim Martin wrote:
Hi - anyone know if there is a valid property to use in the persistence.xml to_______________________________________________
cache all query results by name and parameter values.
So rather than putting a hint on the queries we can do something like
<property name="eclipselink.query-results-cache" value="true"/>
I've come across it searching in google - but not come across anything
defintive...
If so - how would we configure expiration of the cache ? something simple like
expire everything every x minutes would do to start with..
Thanks
Tim
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
« Return to Thread: caching query results for all queries...?
| Free embeddable forum powered by Nabble | Forum Help |