use of lucee.runtime.type.scope.storage.StorageScopeCache in project Lucee by lucee.
the class ClientCache method getInstance.
/**
* load an new instance of the client datasource scope
* @param cacheName
* @param appName
* @param pc
* @param log
* @return client datasource scope
* @throws PageException
*/
public static Client getInstance(String cacheName, String appName, PageContext pc, Client existing, Log log) throws PageException {
if (appName != null && appName.startsWith("no-in-memory-cache-"))
existing = null;
synchronized (token) {
StorageValue sv = _loadData(pc, cacheName, appName, "client", log);
if (sv != null) {
long time = sv.lastModified();
if (existing instanceof StorageScopeCache) {
if (((StorageScopeCache) existing).lastModified() >= time)
return existing;
}
return new ClientCache(pc, cacheName, appName, sv.getValue(), time);
} else if (existing != null)
return existing;
ClientCache cc = new ClientCache(pc, cacheName, appName, new StructImpl(), 0);
cc.store(pc);
return cc;
}
}
use of lucee.runtime.type.scope.storage.StorageScopeCache in project Lucee by lucee.
the class SessionCache method getInstance.
/**
* load an new instance of the client datasource scope
* @param cacheName
* @param appName
* @param pc
* @return client datasource scope
* @throws PageException
*/
public static Session getInstance(String cacheName, String appName, PageContext pc, Session existing, Log log) throws PageException {
if (appName != null && appName.startsWith("no-in-memory-cache-"))
existing = null;
synchronized (token) {
StorageValue sv = _loadData(pc, cacheName, appName, "session", log);
if (sv != null) {
long time = sv.lastModified();
if (existing instanceof StorageScopeCache) {
if (((StorageScopeCache) existing).lastModified() >= time) {
return existing;
}
}
return new SessionCache(pc, cacheName, appName, sv.getValue(), time);
} else if (existing != null) {
return existing;
}
SessionCache session = new SessionCache(pc, cacheName, appName, new StructImpl(), 0);
session.store(pc);
return session;
}
}
Aggregations