Files
velocity-pay-springboot/src/main/java/zw/qantra/tm/domain/controllers/ConfigController.java

36 lines
1.4 KiB
Java

package zw.qantra.tm.domain.controllers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.CacheManager;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zw.qantra.tm.domain.services.ChargeConditionService;
import zw.qantra.tm.domain.services.ChargeService;
import zw.qantra.tm.domain.services.IntegrationProcessorService;
import zw.qantra.tm.domain.services.CategoryService;
import zw.qantra.tm.domain.services.PaymentProcessorService;
import zw.qantra.tm.domain.services.ProviderService;
@Slf4j
@RestController
@RequestMapping("/configs")
@RequiredArgsConstructor
public class ConfigController {
private final ChargeConditionService chargeConditionService;
private final ChargeService chargeService;
private final PaymentProcessorService paymentProcessorService;
private final ProviderService providerService;
private final CategoryService categoryService;
private final IntegrationProcessorService integrationProcessorService;
private final CacheManager cacheManager;
@GetMapping("/cache/clear")
public ResponseEntity clearCache(){
cacheManager.getCacheNames().forEach(name -> cacheManager.getCache(name).clear());
return ResponseEntity.ok("Cache cleared");
}
}