Query persistence for all defined {@link TaskDef} data, and cache it in {@link #taskDefCache}.
556638
private void refreshTaskDefs() {
        try {
            withTransaction(tx -> {
                Map<String, TaskDef> map = new HashMap<>();
                findAllTaskDefs(tx).forEach(taskDef -> map.put(taskDef.getName(), taskDef));

                synchronized (taskDefCache) {
                    taskDefCache.clear();
                    taskDefCache.putAll(map);
                }

                if (logger.isTraceEnabled()) {
                    logger.trace("Refreshed {} TaskDefs", taskDefCache.size());
                }
            });
        } catch (Exception e){
            Monitors.error(className, "refreshTaskDefs");
            logger.error("refresh TaskDefs failed ", e);
        }
    }
1033666
private boolean isOurActiveTask(Tenant tenant, String taskID) {
        synchronized (m_activeTasks) {
            return m_activeTasks.containsKey(createMapKey(tenant, taskID));
        }
    }
339863
@Override
	public TaskBase getTask(DeferredEvent deferredEvent) {
		return getTask(deferredEvent.getProcessDefinitionName(),deferredEvent.getTaskId());
	}
371175
function cacheQuery () {
    // debug
    debug('view:id:record:get', this.idCacheKeys, this.ids)
    // attempt to get from cache
    return this.cache.redis.mgetAsync(this.idCacheKeys)
    // check result
    .then(cached => this.cacheQueryResult(cached))
}
103292
protected void drainCache() {
    // Route the tuples to correct places
    Map<Integer, List<HeronTuples.HeronTupleSet>> cache = tupleCache.getCache();

    if (!isSendTuplesToInstance(new LinkedList<Integer>(cache.keySet()))) {
      // Check whether we could send tuples
      return;
    }

    for (Map.Entry<Integer, List<HeronTuples.HeronTupleSet>> entry : cache.entrySet()) {
      int taskId = entry.getKey();
      for (HeronTuples.HeronTupleSet message : entry.getValue()) {
        sendInBound(taskId, message);
      }
    }

    // Reset the tupleCache
    tupleCache.clear();
  }
1173203
private void onSetCaching(CfDef cfDef, Properties cfProperties, StringBuilder builder)
    {
        String caching = cfProperties.getProperty(CassandraConstants.CACHING);
        if (caching != null)
        {
            if (builder != null)
            {
                appendPropertyToBuilder(builder, caching, CassandraConstants.CACHING);
            }
            else
            {
                cfDef.setCaching(caching);
            }
        }
    }
764820
def _build_cache():
    """"""
    query = current_app.config['COLLECTIONS_DELETED_RECORDS']
    for collection in Collection.query.filter(
            Collection.dbquery.isnot(None)).all():
        yield collection.name, dict(
            query=query.format(dbquery=collection.dbquery),
            ancestors=set(_ancestors(collection)),
        )
    raise StopIteration
164278
protected Query[] buildPrefetchQueries(Collection owners, Collection children)
    {
        ClassDescriptor cld = getOwnerClassDescriptor();
        ObjectReferenceDescriptor ord = getObjectReferenceDescriptor();
        Collection queries = new ArrayList(owners.size());
        Collection idsSubset = new HashSet(owners.size());
        Iterator iter = owners.iterator();
        Class topLevelClass = getBroker().getTopLevelClass(ord.getItemClass());
        Object[] fkValues;
        Object owner;
        Identity id;
        PersistenceBroker pb = getBroker();
        ObjectCache cache = pb.serviceObjectCache();

        while (iter.hasNext())
        {
            owner = iter.next();
            fkValues = ord.getForeignKeyValues(owner,cld);
            if (isNull(fkValues))
            {
                continue;
            }
            id = pb.serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
            if (cache.lookup(id) != null)
            {
                children.add(pb.getObjectByIdentity(id));
                continue;
            }
            idsSubset.add(id);
            if (idsSubset.size() == pkLimit)
            {
                queries.add(buildPrefetchQuery(idsSubset));
                idsSubset.clear();
            }
        }

        if (idsSubset.size() > 0)
        {
            queries.add(buildPrefetchQuery(idsSubset));
        }

        return (Query[]) queries.toArray(new Query[queries.size()]);
    }
1221380
@Override public Collection<Task> getAppTasks(ApplicationDefinition appDef) {
        checkServiceState();
        List<Task> appTasks = new ArrayList<>();
        appTasks.add(new LogServiceAgerTask(appDef));
        appTasks.add(new LogServiceMergerTask(appDef));
        return appTasks;
    }
967097
public List<T> queryForAll(ConnectionSource connectionSource, ObjectCache objectCache) throws SQLException {
		prepareQueryForAll();
		return query(connectionSource, preparedQueryForAll, objectCache);
	}
381755
private static synchronized CacheInfo getCacheInfo() {
		AppContext context = AppContext.getAppContext();
		CacheInfo info = (CacheInfo) context.get(CacheInfo.class);
		if (info == null) {
			info = new CacheInfo();
			context.put(CacheInfo.class, info);
		}
		return info;
	}
759392
private void loadAllAndKeepExisting(Set<? extends K> keys) {
    List<K> keysToLoad = keys.stream()
        .filter(key -> !cache.asMap().containsKey(key))
        .collect(toList());
    Map<K, V> result = cacheLoader.get().loadAll(keysToLoad);
    for (Map.Entry<K, V> entry : result.entrySet()) {
      if ((entry.getKey() != null) && (entry.getValue() != null)) {
        putIfAbsentNoAwait(entry.getKey(), entry.getValue(), /* publishToWriter */ false);
      }
    }
  }
152300
@Override
	public void cacheResult(CPDefinitionLink cpDefinitionLink) {
		entityCache.putResult(CPDefinitionLinkModelImpl.ENTITY_CACHE_ENABLED,
			CPDefinitionLinkImpl.class, cpDefinitionLink.getPrimaryKey(),
			cpDefinitionLink);

		finderCache.putResult(FINDER_PATH_FETCH_BY_UUID_G,
			new Object[] {
				cpDefinitionLink.getUuid(), cpDefinitionLink.getGroupId()
			}, cpDefinitionLink);

		finderCache.putResult(FINDER_PATH_FETCH_BY_C_C_T,
			new Object[] {
				cpDefinitionLink.getCPDefinitionId(),
				cpDefinitionLink.getCProductId(), cpDefinitionLink.getType()
			}, cpDefinitionLink);

		cpDefinitionLink.resetOriginalValues();
	}
514580
public List<CacheReference> referencedFields() {
    List<CacheReference> cacheReferences = new ArrayList<>();
    for (Object value : fields.values()) {
      findCacheReferences(value, cacheReferences);
    }
    return cacheReferences;
  }
731006
private Cache<QueryCacheKey, Object> getCache() {
      final Cache<QueryCacheKey, Object> cache = lazyCache;

      //Most likely branch first:
      if (cache != null) {
         return cache;
      }
      synchronized (this) {
         if (lazyCache == null) {
            // define the query cache configuration if it does not already exist (from a previous call or manually defined by the user)
            internalCacheRegistry.registerInternalCache(QUERY_CACHE_NAME, getQueryCacheConfig().build(), EnumSet.noneOf(InternalCacheRegistry.Flag.class));
            lazyCache = cacheManager.getCache(QUERY_CACHE_NAME);
         }
         return lazyCache;
      }
   }
515035
public TaskDef getTaskDef(String taskType) {
        Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
        return getForEntity("metadata/taskdefs/{tasktype}", null, TaskDef.class, taskType);
    }
1119755
private void persistCache(String projectName, String projectVersion, Map<String, String> cache) {
		File cacheFile = new File(getCacheDir(), projectName + "/" + projectVersion);
		ObjectOutputStream oos = null;
		try {
			oos = new ObjectOutputStream(new FileOutputStream(cacheFile));
			oos.writeObject(cache);
		}
		catch (IOException ioe) {
			LOGGER.warn("Unable to create the cache file {}/{}/{}", getCacheDir().getAbsoluteFile(), projectName, projectVersion);
		}
		finally { if (oos != null) { try { oos.close(); } catch (IOException ioe) {} } }
	}