Kaynağa Gözat

cleanup

tags/v0.3.0
Jonathan Cobb 4 yıl önce
ebeveyn
işleme
b17674722f
1 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. +6
    -6
      bubble-server/src/main/java/bubble/service/SearchService.java

+ 6
- 6
bubble-server/src/main/java/bubble/service/SearchService.java Dosyayı Görüntüle

@@ -32,7 +32,7 @@ public class SearchService {

private Map<String, DAO> daoCache = new ConcurrentHashMap<>();

private ExpirationMap<String, Object> _searchCache = new ExpirationMap<String, Object>()
private ExpirationMap<String, Object> searchCache = new ExpirationMap<String, Object>()
.setExpiration(MINUTES.toMillis(2))
.setMaxExpiration(MINUTES.toMillis(2))
.setCleanInterval(MINUTES.toMillis(5))
@@ -83,10 +83,10 @@ public class SearchService {

final SearchResults results;
if (nocache != null && nocache) {
results = _search(dao, q, caller);
results = search(dao, q, caller);
} else {
final String cacheKey = hashOf(caller.getUuid(), type, q);
results = (SearchResults) _searchCache.computeIfAbsent(cacheKey, searchKey -> _search(dao, q, caller));
results = (SearchResults) searchCache.computeIfAbsent(cacheKey, searchKey -> search(dao, q, caller));
}
if (results.hasNextPage(q)) {
results.setNextPage(requestURI +"?"+ ApiConstants.Q_PAGE+"="+(q.getPageNumber()+1)+"&"+ ApiConstants.Q_SIZE+"="+q.getPageSize());
@@ -94,9 +94,9 @@ public class SearchService {
return results;
}

public static SearchResults _search(DAO dao,
SearchQuery q,
Account caller) {
public static SearchResults search(DAO dao,
SearchQuery q,
Account caller) {
if (!caller.admin()) {
final Class entityClass = dao.getEntityClass();
if (entityClass.equals(Account.class)) {


Yükleniyor…
İptal
Kaydet