Изменено кэширование

This commit is contained in:
serega6531
2019-11-24 01:50:15 +03:00
parent 389567b469
commit 56e84f6566
9 changed files with 39 additions and 48 deletions

View File

@@ -1,7 +1,6 @@
package ru.serega6531.packmate.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import ru.serega6531.packmate.model.Packet;
import ru.serega6531.packmate.model.Stream;
@@ -19,13 +18,12 @@ public class PacketService {
this.repository = repository;
}
@Cacheable(value = "packets", key = "#stream.id")
public List<Packet> getPacketsForStream(Stream stream) {
return repository.findAllByStream(stream);
}
public Packet save(Packet packet) {
return repository.save(packet);
public List<Packet> saveAll(List<Packet> packets) {
return repository.saveAll(packets);
}
}