Author: aadamchik
Date: Thu Jun 15 23:48:27 2006
New Revision: 414756
URL: http://svn.apache.org/viewvc?rev=414756&view=rev
Log:
Local caching of client paginated lists is broken
* on the remote client, paginated query is intercepted before the local cache,
thus local cache settings are ignored.
* on the server: RemoteIncrementalFaultList overrides the query cache key, so
cached IncrementalFaultLists can't be reused and a new list created on every
query, taking lots of memory.
(I can't log in to Jira due to Apache network problems; I will enter the bug
once this is resolved)
Modified:
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/CayenneContextQueryAction.java
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/remote/RemoteIncrementalFaultList.java
Modified:
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/CayenneContextQueryAction.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/CayenneContextQueryAction.java?rev=414756&r1=414755&r2=414756&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/CayenneContextQueryAction.java
(original)
+++
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/CayenneContextQueryAction.java
Thu Jun 15 23:48:27 2006
@@ -75,10 +75,11 @@
}
public QueryResponse execute() {
- if (interceptPaginatedQuery() != DONE) {
- if (interceptOIDQuery() != DONE) {
- if (interceptRelationshipQuery() != DONE) {
- if (interceptLocalCache() != DONE) {
+
+ if (interceptOIDQuery() != DONE) {
+ if (interceptRelationshipQuery() != DONE) {
+ if (interceptLocalCache() != DONE) {
+ if (interceptPaginatedQuery() != DONE) {
runQuery();
}
}
@@ -126,7 +127,10 @@
}
}
- runQuery();
+ if (interceptPaginatedQuery() != DONE) {
+ runQuery();
+ }
+
graphManager.cacheQueryResult(cacheKey, response.firstList());
return DONE;
}
Modified:
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/remote/RemoteIncrementalFaultList.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/remote/RemoteIncrementalFaultList.java?rev=414756&r1=414755&r2=414756&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/remote/RemoteIncrementalFaultList.java
(original)
+++
incubator/cayenne/main/trunk/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/remote/RemoteIncrementalFaultList.java
Thu Jun 15 23:48:27 2006
@@ -129,7 +129,13 @@
? (ListHelper) new DataRowListHelper()
: new PersistentListHelper();
this.context = context;
- this.cacheKey = generateCacheKey();
+
+ // use provided cache key if possible; this would allow clients to
+ // address the same server-side list from multiple queries.
+ this.cacheKey = metadata.getCacheKey();
+ if(cacheKey == null) {
+ cacheKey = generateCacheKey();
+ }
IncrementalQuery query = new IncrementalQuery(paginatedQuery,
cacheKey);