/** * Return a key for the given query, or null if it is not cacheable. */ public static QueryKey newInstance(Query q) { return newInstance(q, (Object[]) null); }
/** * Return a key for the given query, or null if it is not cacheable. */ static QueryKey newInstance(QueryContext q, boolean packed, Object[] args, Class<?> candidate, boolean subs, long startIdx, long endIdx, Object parsed) { QueryKey key = createKey(q, packed, candidate, subs, startIdx, endIdx, parsed); if (key != null && setParams(key, q, args)) return key; return null; }
/** * Constructor; supply corresponding query key and result data. */ public QueryResult(QueryKey key, Collection<Object> data) { super(data); if (key.getTimeout() == -1) _ex = -1; else _ex = System.currentTimeMillis() + key.getTimeout(); }
if (intersects(accessPathClassNames, ctx.getPersistedTypes()) || intersects(accessPathClassNames, ctx.getUpdatedTypes()) || intersects(accessPathClassNames, ctx.getDeletedTypes())) return null; QueryKey key = new QueryKey(); key._candidateClassName = candidateClass.getName(); key._subclasses = subclasses;
public void onTypesChanged(TypesChangedEvent ev) { if (_qk.changeInvalidatesQuery(ev.getTypes())) abortCaching(); } }
private QueryKey findKey(String key) { QueryStatistics<QueryKey> stats = getStatistics(); for (QueryKey qk : stats.keys()) { if (qk.toString().equals(key)) { return qk; } } return null; }
/** * Returns <code>true</code> if modifications to any of the * classes in <code>changed</code> results in a possible * invalidation of this query; otherwise returns * <code>false</code>. Invalidation is possible if one or more of * the classes in this query key's access path has been changed. */ public boolean changeInvalidatesQuery(Collection<Class<?>> changed) { return intersects(_accessPathClassNames, changed); }
/** * Convert an array of arguments into the corresponding parameter * map, and do any PC to OID conversion necessary. */ private static boolean setParams(QueryKey key, QueryContext q, Object[] args) { if (args == null || args.length == 0) return true; // Create a map for the given parameters, and convert the // parameter list into a map, using the query's parameter // declaration to determine ordering etc. Map<Object,Class<?>> types = q.getOrderedParameterTypes(); Map<Object,Object> map = new HashMap<Object,Object>((int) (types.size() * 1.33 + 1)); int idx = 0; for (Iterator<Object> iter = types.keySet().iterator(); iter.hasNext(); idx++) map.put(iter.next(), args[idx]); return setParams(key, q.getStoreContext(), map); }
AbstractQueryCache qcache = (AbstractQueryCache) _cache; if (qcache.getEvictPolicy() == EvictPolicy.TIMESTAMP) { Set<String> classNames = qk.getAcessPathClassNames(); List<String> keyList = new ArrayList<String>(); keyList.addAll(classNames);
if (intersects(accessPathClassNames, ctx.getPersistedTypes()) || intersects(accessPathClassNames, ctx.getUpdatedTypes()) || intersects(accessPathClassNames, ctx.getDeletedTypes())) return null; QueryKey key = new QueryKey(); key._candidateClassName = candidateClass.getName(); key._subclasses = subclasses;
public void onTypesChanged(TypesChangedEvent ev) { if (_qk.changeInvalidatesQuery(ev.getTypes())) abortCaching(); } }
private QueryKey findKey(String key) { QueryStatistics<QueryKey> stats = getStatistics(); for (QueryKey qk : stats.keys()) { if (qk.toString().equals(key)) { return qk; } } return null; }
/** * Returns <code>true</code> if modifications to any of the * classes in <code>changed</code> results in a possible * invalidation of this query; otherwise returns * <code>false</code>. Invalidation is possible if one or more of * the classes in this query key's access path has been changed. */ public boolean changeInvalidatesQuery(Collection<Class<?>> changed) { return intersects(_accessPathClassNames, changed); }
/** * Convert an array of arguments into the corresponding parameter * map, and do any PC to OID conversion necessary. */ private static boolean setParams(QueryKey key, QueryContext q, Object[] args) { if (args == null || args.length == 0) return true; // Create a map for the given parameters, and convert the // parameter list into a map, using the query's parameter // declaration to determine ordering etc. Map types = q.getParameterTypes(); Map map = new HashMap((int) (types.size() * 1.33 + 1)); int idx = 0; for (Iterator iter = types.keySet().iterator(); iter.hasNext(); idx++) map.put(iter.next(), args[idx]); return setParams(key, q.getStoreContext(), map); }
AbstractQueryCache qcache = (AbstractQueryCache) _cache; if (qcache.getEvictPolicy() == EvictPolicy.TIMESTAMP) { Set<String> classNames = qk.getAcessPathClassNames(); List<String> keyList = new ArrayList<String>(); keyList.addAll(classNames);
/** * Return a key for the given query, or null if it is not cacheable. */ public static QueryKey newInstance(Query q) { return newInstance(q, (Object[]) null); }
/** * Return a key for the given query, or null if it is not cacheable. */ static QueryKey newInstance(QueryContext q, boolean packed, Object[] args, Class<?> candidate, boolean subs, long startIdx, long endIdx, Object parsed) { QueryKey key = createKey(q, packed, candidate, subs, startIdx, endIdx, parsed); if (key != null && setParams(key, q, args)) return key; return null; }
if (intersects(accessPathClassNames, ctx.getPersistedTypes()) || intersects(accessPathClassNames, ctx.getUpdatedTypes()) || intersects(accessPathClassNames, ctx.getDeletedTypes())) return null; QueryKey key = new QueryKey(); key._candidateClassName = candidateClass.getName(); key._subclasses = subclasses;
public void onTypesChanged(TypesChangedEvent ev) { if (_qk.changeInvalidatesQuery(ev.getTypes())) abortCaching(); } }
/** * Returns all query keys currently tracked in the cache. * @return */ public Set<String> queryKeys() { QueryStatistics<QueryKey> stats = getStatistics(); if (stats != null) { Set<String> keys = new HashSet<String>(); for (QueryKey qk : stats.keys()) { keys.add(qk.toString()); } return keys; } return null; }