Redis cache function upgrade
This commit is contained in:
@@ -13,6 +13,8 @@ import jakarta.persistence.EntityNotFoundException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -28,6 +30,7 @@ public class CommonCodeCoreService
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Cacheable(value = "commonCodes")
|
||||
public List<CommonCodeDto.Basic> findAll() {
|
||||
return commonCodeRepository.findByAll().stream().map(CommonCodeEntity::toDto).toList();
|
||||
}
|
||||
@@ -38,6 +41,7 @@ public class CommonCodeCoreService
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ResponseObj save(CommonCodeDto.AddReq req) {
|
||||
|
||||
String regex = "^[A-Z0-9_]+$";
|
||||
@@ -88,6 +92,7 @@ public class CommonCodeCoreService
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ResponseObj update(Long id, CommonCodeDto.ModifyReq req) {
|
||||
CommonCodeEntity found =
|
||||
commonCodeRepository
|
||||
@@ -111,6 +116,7 @@ public class CommonCodeCoreService
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ResponseObj updateOrder(CommonCodeDto.OrderReq req) {
|
||||
|
||||
CommonCodeEntity found =
|
||||
@@ -145,6 +151,7 @@ public class CommonCodeCoreService
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = "commonCodes", allEntries = true)
|
||||
public ResponseObj removeCode(Long id) {
|
||||
CommonCodeEntity entity =
|
||||
commonCodeRepository
|
||||
|
||||
Reference in New Issue
Block a user