use of lucee.runtime.cache.CacheConnection in project Lucee by lucee.
the class ModernApplicationContext method _initCache.
private void _initCache(Map<Key, CacheConnection> cacheConnections, Iterator<Entry<Key, Object>> it, boolean sub) {
Entry<Key, Object> e;
Struct sct;
CacheConnection cc;
while (it.hasNext()) {
e = it.next();
if (!sub && KeyConstants._function.equals(e.getKey()) || KeyConstants._query.equals(e.getKey()) || KeyConstants._template.equals(e.getKey()) || KeyConstants._object.equals(e.getKey()) || KeyConstants._include.equals(e.getKey()) || KeyConstants._resource.equals(e.getKey()) || KeyConstants._http.equals(e.getKey()) || KeyConstants._file.equals(e.getKey()) || KeyConstants._webservice.equals(e.getKey()))
continue;
if (!sub && KeyConstants._connections.equals(e.getKey())) {
Struct _sct = Caster.toStruct(e.getValue(), null);
if (_sct != null)
_initCache(cacheConnections, _sct.entryIterator(), true);
continue;
}
sct = Caster.toStruct(e.getValue(), null);
if (sct == null)
continue;
cc = toCacheConnection(config, e.getKey().getString(), sct, null);
if (cc != null) {
cacheConnections.put(e.getKey(), cc);
Key def = Caster.toKey(sct.get(KeyConstants._default, null), null);
if (def != null) {
String n = e.getKey().getString().trim();
if (KeyConstants._function.equals(def))
defaultCaches.put(Config.CACHE_TYPE_FUNCTION, n);
else if (KeyConstants._query.equals(def))
defaultCaches.put(Config.CACHE_TYPE_QUERY, n);
else if (KeyConstants._template.equals(def))
defaultCaches.put(Config.CACHE_TYPE_TEMPLATE, n);
else if (KeyConstants._object.equals(def))
defaultCaches.put(Config.CACHE_TYPE_OBJECT, n);
else if (KeyConstants._include.equals(def))
defaultCaches.put(Config.CACHE_TYPE_INCLUDE, n);
else if (KeyConstants._resource.equals(def))
defaultCaches.put(Config.CACHE_TYPE_RESOURCE, n);
else if (KeyConstants._http.equals(def))
defaultCaches.put(Config.CACHE_TYPE_HTTP, n);
else if (KeyConstants._file.equals(def))
defaultCaches.put(Config.CACHE_TYPE_FILE, n);
else if (KeyConstants._webservice.equals(def))
defaultCaches.put(Config.CACHE_TYPE_WEBSERVICE, n);
}
}
}
}
Aggregations