use of lucee.runtime.PageSourcePool in project Lucee by lucee.
the class Controler method removeOldest.
private void removeOldest(PageSourcePool[] pools) {
PageSourcePool pool = null;
String key = null;
PageSource ps = null;
long date = -1;
for (int i = 0; i < pools.length; i++) {
try {
String[] keys = pools[i].keys();
for (int y = 0; y < keys.length; y++) {
ps = pools[i].getPageSource(keys[y], false);
if (date == -1 || date > ps.getLastAccessTime()) {
pool = pools[i];
key = keys[y];
date = ps.getLastAccessTime();
}
}
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
pools[i].clear();
}
}
if (pool != null)
pool.remove(key);
}
use of lucee.runtime.PageSourcePool in project Lucee by lucee.
the class GetUsageData method templateCacheElements.
private static long[] templateCacheElements(Mapping[] mappings) {
long elements = 0, size = 0;
PageSourcePool psp;
String[] keys;
PageSourceImpl ps;
Resource res;
MappingImpl mapping;
for (int i = 0; i < mappings.length; i++) {
mapping = (MappingImpl) mappings[i];
psp = mapping.getPageSourcePool();
keys = psp.keys();
for (int y = 0; y < keys.length; y++) {
ps = (PageSourceImpl) psp.getPageSource(keys[y], false);
if (ps.isLoad()) {
elements++;
res = mapping.getClassRootDirectory().getRealResource(ps.getClassName().replace('.', '/') + ".class");
size += res.length();
}
}
}
return new long[] { elements, size };
}
Aggregations