use of lucee.commons.io.cache.CacheEntry in project Lucee by lucee.
the class CacheSupport method remove.
@Override
public int remove(CacheEntryFilter filter) throws IOException {
if (CacheUtil.allowAll(filter))
return clear();
List<String> keys = keys();
int count = 0;
Iterator<String> it = keys.iterator();
String key;
CacheEntry entry;
while (it.hasNext()) {
key = it.next();
entry = getQuiet(key, null);
if (filter == null || filter.accept(entry)) {
remove(key);
count++;
}
}
return count;
}
use of lucee.commons.io.cache.CacheEntry in project Lucee by lucee.
the class CacheHandlerCollectionImpl method clear.
public static void clear(PageContext pc, Cache cache, CacheHandlerFilter filter) {
try {
Iterator<CacheEntry> it = cache.entries().iterator();
CacheEntry ce;
Object obj;
while (it.hasNext()) {
ce = it.next();
if (filter == null) {
cache.remove(ce.getKey());
continue;
}
obj = ce.getValue();
if (obj instanceof QueryCacheItem)
obj = ((QueryCacheItem) obj).getQuery();
if (filter.accept(obj))
cache.remove(ce.getKey());
}
} catch (IOException e) {
}
}
use of lucee.commons.io.cache.CacheEntry in project Lucee by lucee.
the class CacheComplex method entries.
private List<CacheEntry> entries(List<CacheEntry> entries) {
if (entries == null || entries.size() == 0)
return entries;
Iterator<CacheEntry> it = entries.iterator();
ArrayList<CacheEntry> list = new ArrayList<CacheEntry>(entries.size());
CacheEntry entry;
while (it.hasNext()) {
entry = it.next();
if (entry != null)
list.add(new CacheComplexEntry(this, entry));
}
return list;
}
use of lucee.commons.io.cache.CacheEntry in project Lucee by lucee.
the class CacheResourceProvider method touch.
void touch(String path, String name) throws IOException {
Cache cache = getCache();
CacheEntry ce = cache.getCacheEntry(toKey(path, name), null);
if (ce != null) {
cache.put(ce.getKey(), ce.getValue(), ce.idleTimeSpan(), ce.liveTimeSpan());
}
}
Aggregations