Gets the cached query object. The key used for lookup is an object pair containing the query string and a
discriminator value which is usually the Class of the cached query object and an optional {@link List} of {@link
FieldAccumulator}s.
9548
public <T> T get(String queryString, List<FieldAccumulator> accumulators, Object queryTypeDiscriminator, QueryCreator<T> queryCreator) {
      QueryCacheKey key = new QueryCacheKey(queryString, accumulators, queryTypeDiscriminator);
      return (T) getCache().computeIfAbsent(key, (k) -> queryCreator.create(k.queryString, k.accumulators));
   }
1136232
def _getCachedValue(obj, relicFunc, resultType):
    
    # If the value has not been previously cached, fetch 
    if not obj.cached:
        obj.cached = resultType()
        relicFunc(byref(obj.cached))
    return obj.cached
20
static Field lookupField(Class<?> javaClass, String fieldName) throws NoSuchFieldException {
        if (System.getSecurityManager() != null) {
            try {
                return AccessController.doPrivileged(new FieldLookupAction(javaClass, fieldName));
            } catch (PrivilegedActionException e) {
                if (e.getCause() instanceof NoSuchFieldException) {
                    throw (NoSuchFieldException) e.getCause();
                }
                throw new WeldException(e.getCause());
            }
        } else {
            return FieldLookupAction.lookupField(javaClass, fieldName);
        }
    }
701661
private static CtMethod getFieldGetter(CtField field, CtClass clazz) throws NotFoundException {
        if (field == null) {
            return null;
        }
        return getFieldGetter(field, clazz, false);
    }
1026623
function cacheQuery () {
    // debug
    debug('id:get', this.idCacheKeys, this.ids)
    // attempt to get from cache
    return this.cache.redis.mgetAsync(this.idCacheKeys)
    // check result
    .then(cached => {
        // list of ids that where not cached
        this.uncachedIds = []
        // check result set for uncached ids
        for (var i=0; i < this.numIds; i++) {
            var cachedValue = undefined
            // decode result if not null
            if (cached[i] !== null) {
                try {
                    // decode JSON
                    cachedValue = JSON.parse(cached[i])
                    // add cached flag
                    cachedValue._cached = true
                }
                catch (err) {
                    // ignore errors
                }
            }
            // if there is cached value use otherwise add id to fetch list
            defined(cachedValue)
                ? this.cached.push(cachedValue)
                : this.uncachedIds.push(this.ids[i])
        }
        // debug
        debug('id:uncachedIds', this.uncachedIds)
        // if all records were cached the return result from cache
        return this.uncachedIds.length === 0
            ? this.cached
            : this.loadUncached()
    })
}
972881
public static QueryFactory getQueryFactory(Cache<?, ?> cache) {
      if (cache == null || cache.getAdvancedCache() == null) {
         throw new IllegalArgumentException("cache parameter shall not be null");
      }
      AdvancedCache<?, ?> advancedCache = cache.getAdvancedCache();
      ensureAccessPermissions(advancedCache);
      EmbeddedQueryEngine queryEngine = SecurityActions.getCacheComponentRegistry(advancedCache).getComponent(EmbeddedQueryEngine.class);
      if (queryEngine == null) {
         throw log.queryModuleNotInitialised();
      }
      return new EmbeddedQueryFactory(queryEngine);
   }
659276
@SuppressFBWarnings(value = "GC_UNRELATED_TYPES", justification = "Cross-comparison is intended")
    public Class<?> find(ClassLoader classLoader, T key) {
        ConcurrentMap<T, Reference<Class<?>>> storage = cache.get(new LookupKey(classLoader));
        if (storage == null) {
            return NOT_FOUND;
        } else {
            Reference<Class<?>> reference = storage.get(key);
            if (reference == null) {
                return NOT_FOUND;
            } else {
                return reference.get();
            }
        }
    }
487629
@Override
	public <T> T get(final Object key, final Class<T> clas) {
		this.logger.debug("@get :", key, " with class : ", clas.getName());
		final T Object = (T) getCachableMap(clas).get(key);
		logger.debug("Cached object : ", Object);
		return Object;
	}
1021677
<T> Method getRangeKeyGetter(Class<T> clazz) {
        synchronized (rangeKeyGetterCache) {
            if ( !rangeKeyGetterCache.containsKey(clazz) ) {
                Method rangeKeyMethod = null;
                for ( Method method : getRelevantGetters(clazz) ) {
                    if ( method.getParameterTypes().length == 0 && method.isAnnotationPresent(DynamoDBRangeKey.class)) {
                        rangeKeyMethod = method;
                        break;
                    }
                }
                rangeKeyGetterCache.put(clazz, rangeKeyMethod);
            }
        }
        return rangeKeyGetterCache.get(clazz);
    }
571987
private void cacheUniqueSelectRef(Object object, MappedStatement mt, String cacheKey) {
		Collection<QueryMethodCache> mcs = queryCacheMethods.get(mt.getId().substring(0, mt.getId().lastIndexOf(SPLIT_PONIT))).values();
		outter:for (QueryMethodCache methodCache : mcs) {
			if(methodCache.isPk || methodCache.groupRalated)continue;
			try {	
				Object[] cacheFieldValues = new Object[methodCache.fieldNames.length];
				for (int i = 0; i < cacheFieldValues.length; i++) {
					if(methodCache.fieldNames[i] == null)break outter;
					cacheFieldValues[i] = ReflectUtils.getObjectValue(object, methodCache.fieldNames[i]);
					if(cacheFieldValues[i] == null)continue outter;
				}
				String fieldCacheKey = genarateQueryCacheKey(methodCache.keyPattern , cacheFieldValues);
				
				cacheFieldRefKey(fieldCacheKey,cacheKey, methodCache.getExpire());
				if(logger.isDebugEnabled())logger.debug("_autocache_ method[{}] add ref cacheKey:{}",mt.getId(),fieldCacheKey);
			} catch (Exception e) {
				logger.warn("cacheUniqueSelectRef:"+cacheKey,e);
			}
		}
	}
65398
private ObjectCache getCachePerClass(Class objectClass, int methodCall)
    {
        ObjectCache cache = (ObjectCache) cachesByClass.get(objectClass.getName());
        if (cache == null && AbstractMetaCache.METHOD_CACHE == methodCall
                && !cachesByClass.containsKey(objectClass.getName()))
        {
            cache = new ObjectCacheDefaultImpl(null, null);
            setClassCache(objectClass.getName(), cache);
        }
        return cache;
    }
19972
@SuppressWarnings("unchecked")
    protected <T> T lookup(Class<T> entityClass, Object id)
    {
        String key = cacheKey(entityClass, id);
        LOG.debug("Reading from L1 >> " + key);
        T o = (T) sessionCache.get(key);

        // go to second-level cache
        if (o == null)
        {
            LOG.debug("Reading from L2 >> " + key);
            Cache c = (Cache) getL2Cache();
            if (c != null)
            {
                o = (T) c.get(key);
                if (o != null)
                {
                    LOG.debug("Found item in second level cache!");
                }
            }
        }
        return o;
    }
822048
public static Method getAccessor(Class<?> clazz, String field) {
        LOG.trace( "getAccessor({}, {})", clazz, field );
        try {
            return clazz.getMethod( "get" + ucFirst( field ) );
        } catch ( NoSuchMethodException e ) {
            try {
                return clazz.getMethod( field );
            } catch ( NoSuchMethodException e1 ) {
                try {
                    return clazz.getMethod( "is" + ucFirst( field ) );
                } catch ( NoSuchMethodException e2 ) {
                    return null;
                }
            }
        }
    }
195540
public Filter getFilter()
        throws CacheReloadException
    {
        final IWhere where = eqlStmt.getQuery().getWhere();
        final IOrder order = eqlStmt.getOrder();
        return Filter.get(where, order, getTypes().toArray(new Type[getTypes().size()]));
    }
992742
public Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException
    {
        Class itemClass = query.getSearchClass();
        ClassDescriptor cld = getClassDescriptor(itemClass);
        return getIteratorFromQuery(query, cld);
    }
444511
@JSONField(serialize=false)
  public AVQuery<T> getQuery(Class<T> clazz) {
    if (getParent() == null || StringUtil.isEmpty(getParent().getObjectId())) {
      throw new IllegalStateException("unable to encode an association with an unsaved AVObject");
    }

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("object", Utils.mapFromPointerObject(AVRelation.this.getParent()));
    map.put("key", AVRelation.this.getKey());

    Map<String, Object> result = new HashMap<String, Object>();
    result.put("$relatedTo", map);
    String targetClassName = getTargetClass();

    if (StringUtil.isEmpty(getTargetClass())) {
      targetClassName = getParent().getClassName();
    }
    AVQuery<T> query = new AVQuery<T>(targetClassName, clazz);
    query.addWhereItem("$relatedTo", null, map);
    if (StringUtil.isEmpty(getTargetClass())) {
      query.getParameters().put("redirectClassNameForKey", this.getKey());
    }

    return query;
  }
113574
public <T> T asSingleResult() {
		T javaObject = null;
		String cacheKey = getCacheKey();
		if (isCacheable() && transaction == null) {
			Collection<Key> keys = getCacheManager().get(cacheNamespace, cacheKey);
			if (keys != null && keys.size() > 0) {
				Key key = keys.iterator().next();
				try {
					javaObject = (T) entityManager.get(key);
				} catch (EntityNotFoundException e) {
					throw new InconsistentCacheException("Entity Key " + key + " found in the cache but not in the Datastore");
				}
			}
		}
		if (javaObject == null) {
			Entity entity = getDatastoreService().prepare(query).asSingleEntity();
			if (entity == null) {
				throw new org.simpleds.exception.EntityNotFoundException("No " + getKind() + " found with " + getFilterPredicates());
			}
			javaObject = (T) entityManager.datastoreToJava(entity);
			if (isCacheable()) {
                populateCache(cacheKey, ImmutableList.of(entity.getKey()));
			}
		}
		return javaObject;

	}