Skip to content

Commit

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

javax.cache.Cache<String, CachedResponse> cache = CacheService.getCache(cacheSite.get());
@SuppressWarnings("unchecked")
ICache<String, CachedResponse> icache = cache.unwrap(ICache.class);
int cacheSize = icache.size();
int cacheSize = cache.unwrap(ICache.class).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()));
}
idx++;
if (idx++ >= endIdx) {
break;
}
}

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

0 comments on commit 9f071ac

Please sign in to comment.