Skip to content

Commit

Permalink
MGR-128
Browse files Browse the repository at this point in the history
  • Loading branch information
madness-inc committed Dec 9, 2021
1 parent 022ab2f commit 8fa87fb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/org/appng/application/manager/business/Cache.java
Expand Up @@ -109,21 +109,22 @@ public DataContainer getData(Site site, Application application, Environment env
List<CacheEntry> cacheEntries = new ArrayList<>();

javax.cache.Cache<String, CachedResponse> cache = CacheService.getCache(cacheSite.get());
int cacheSize = cache.unwrap(ICache.class).size();
@SuppressWarnings("unchecked")
ICache<String, CachedResponse> icache = cache.unwrap(ICache.class);
int cacheSize = icache.size();

if (cacheSize > maxCacheEntries) {
Iterator<javax.cache.Cache.Entry<String, CachedResponse>> elements = cache.iterator();
int idx = 0;
int startIdx = pageable.getOffset();
int endIdx = pageable.getOffset() + pageable.getPageSize();

Iterator<javax.cache.Cache.Entry<String, CachedResponse>> elements = icache.iterator(endIdx);
while (elements.hasNext()) {
javax.cache.Cache.Entry<java.lang.String, CachedResponse> entry = elements.next();
if (idx >= startIdx && idx < endIdx) {
cacheEntries.add(new CacheEntry(entry.getValue()));
}
if (idx++ >= endIdx) {
break;
}
idx++;
}

fp.getFields().stream().filter(f -> !"id".equals(f.getBinding())).forEach(f -> f.setSort(null));
Expand Down

0 comments on commit 8fa87fb

Please sign in to comment.