|
|
@ -19,6 +19,7 @@ import com.github.benmanes.caffeine.cache.AsyncLoadingCache; |
|
|
import com.github.benmanes.caffeine.cache.Caffeine; |
|
|
import com.github.benmanes.caffeine.cache.Caffeine; |
|
|
import com.google.common.util.concurrent.FluentFuture; |
|
|
import com.google.common.util.concurrent.FluentFuture; |
|
|
import jakarta.annotation.PostConstruct; |
|
|
import jakarta.annotation.PostConstruct; |
|
|
|
|
|
import jakarta.annotation.PreDestroy; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -55,6 +56,12 @@ public class DefaultTbResourceDataCache implements TbResourceDataCache { |
|
|
.buildAsync((key, executor) -> CompletableFuture.supplyAsync(() -> resourceService.getResourceDataInfo(key.tenantId(), key.resourceId()), executor)); |
|
|
.buildAsync((key, executor) -> CompletableFuture.supplyAsync(() -> resourceService.getResourceDataInfo(key.tenantId(), key.resourceId()), executor)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PreDestroy |
|
|
|
|
|
private void destroy() { |
|
|
|
|
|
cache.synchronous().invalidateAll(); |
|
|
|
|
|
cache = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public FluentFuture<TbResourceDataInfo> getResourceDataInfoAsync(TenantId tenantId, TbResourceId resourceId) { |
|
|
public FluentFuture<TbResourceDataInfo> getResourceDataInfoAsync(TenantId tenantId, TbResourceId resourceId) { |
|
|
log.trace("Retrieving resource data info by id [{}], tenant id [{}] from cache", resourceId, tenantId); |
|
|
log.trace("Retrieving resource data info by id [{}], tenant id [{}] from cache", resourceId, tenantId); |
|
|
|