/** * Remove the cache key related to a query. * Note this method is not synchronized and care should be taken to ensure * there are no other threads accessing the cache key. * This is used to clean up cached clones of queries. */ public void clearQueryCache(ReadQuery query) { if (query != null) {// PERF: use query name, unless no name. Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query; } this.queryResults.remove(queryKey); } }
/** * Remove the cache key related to a query. * Note this method is not synchronized and care should be taken to ensure * there are no other threads accessing the cache key. * This is used to clean up cached clones of queries. */ public void clearQueryCache(ReadQuery query) { if (query != null) {// PERF: use query name, unless no name. Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query; } this.queryResults.remove(queryKey); } }
/** * Remove the cache key related to a query. * Note this method is not synchronized and care should be taken to ensure * there are no other threads accessing the cache key. * This is used to clean up cached clones of queries. */ public void clearQueryCache(ReadQuery query) { if (query != null) {// PERF: use query name, unless no name. Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query; } this.queryResults.remove(queryKey); } }
/** * Get the cached results associated with a query. Results are cached by the * values of the parameters to the query so different parameters will have * different cached results. */ public Object getQueryResult(ReadQuery query, List parameters, boolean shouldCheckExpiry) { if (query.getQueryResultsCachePolicy() == null) { return null; } // PERF: use query name, unless no name. Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query; } IdentityMap map = this.queryResults.get(queryKey); if (map == null) { return null; } Object lookupParameters; if ((parameters == null) || parameters.isEmpty()) { lookupParameters = CacheId.EMPTY; } else { lookupParameters = new CacheId(parameters.toArray()); } CacheKey key = map.getCacheKey(lookupParameters, false); if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) { return null; } return key.getObject(); }
/** * Get the cached results associated with a query. Results are cached by the * values of the parameters to the query so different parameters will have * different cached results. */ public Object getQueryResult(ReadQuery query, List parameters, boolean shouldCheckExpiry) { if (query.getQueryResultsCachePolicy() == null) { return null; } // PERF: use query name, unless no name. Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query; } IdentityMap map = this.queryResults.get(queryKey); if (map == null) { return null; } Object lookupParameters; if ((parameters == null) || parameters.isEmpty()) { lookupParameters = CacheId.EMPTY; } else { lookupParameters = new CacheId(parameters.toArray()); } CacheKey key = map.getCacheKey(lookupParameters, false); if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) { return null; } return key.getObject(); }
Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query;
/** * Get the cached results associated with a query. Results are cached by the * values of the parameters to the query so different parameters will have * different cached results. */ public Object getQueryResult(ReadQuery query, Vector parameters, boolean shouldCheckExpiry) { if (query.getQueryResultsCachePolicy() == null) { return null; } // PERF: use query name, unless no name. Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query; } IdentityMap map = this.queryResults.get(queryKey); if (map == null) { return null; } Vector lookupParameters = parameters; if (lookupParameters == null) { lookupParameters = new NonSynchronizedVector(0); } CacheKey key = map.getCacheKey(lookupParameters); if ((key == null) || (shouldCheckExpiry && query.getQueryResultsCachePolicy().getCacheInvalidationPolicy().isInvalidated(key))) { return null; } return key.getObject(); }
Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query;
Object queryKey = query.getName(); if ((queryKey == null) || ((String)queryKey).length() == 0) { queryKey = query;