|
|
@@ -9,6 +9,7 @@ import com.danielbohry.stocks.service.stock.StockEncryptService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -43,6 +44,7 @@ public class PortfolioHistoryService {
|
|
|
saveSnapshots(portfolios);
|
|
|
}
|
|
|
|
|
|
+ @Cacheable(value = "portfolioHistory", key = "#portfolioId + '-' + #currency")
|
|
|
public List<PortfolioHistory> getSnapshots(String portfolioId, String currency) {
|
|
|
List<PortfolioHistory> history = repository.findAllByPortfolioId(portfolioId).stream()
|
|
|
.map(entity -> PortfolioHistory.builder()
|