CacheController.java 1.29 KB
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
package pwc.taxtech.atms.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import pwc.taxtech.atms.dto.CacheDto;
import pwc.taxtech.atms.service.CacheService;

@RestController
@RequestMapping("/api/v1/cache/")
public class CacheController {

    @Autowired
    private CacheService cacheService;

    @ApiOperation(value = "Get all cache")
    @RequestMapping(value = "getallcache", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody List<CacheDto> getAllCache() {
        return cacheService.getAllCache();
    }

    @ApiOperation(value = "Get cache by key")
    @RequestMapping(value = "getcachebykey", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public CacheDto getCacheByKey(@RequestParam("cacheKey") String cacheKey) {
        return cacheService.getCacheByKey(cacheKey);
    }
}