|
@@ -0,0 +1,45 @@
|
|
|
+package com.qmth.demo.api.controller;
|
|
|
+
|
|
|
+import com.qmth.boot.api.annotation.Aac;
|
|
|
+import com.qmth.boot.api.annotation.BOOL;
|
|
|
+import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.boot.core.cache.service.CacheService;
|
|
|
+import com.qmth.demo.api.cache.DemoCacheService;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/cache")
|
|
|
+@Aac(strict = BOOL.FALSE, auth = BOOL.FALSE)
|
|
|
+public class CacheController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private DemoCacheService demoCacheService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CacheService cacheService;
|
|
|
+
|
|
|
+ @RequestMapping("/list")
|
|
|
+ public Object list() {
|
|
|
+ return cacheService.endpoints();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/get")
|
|
|
+ public Object get(@RequestParam String key) {
|
|
|
+ return demoCacheService.get(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/put")
|
|
|
+ public Object put(@RequestParam String key, @RequestParam String value) {
|
|
|
+ return demoCacheService.put(key, value);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping("/clear")
|
|
|
+ public Object clear(@RequestParam String key) {
|
|
|
+ return demoCacheService.clear(key);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|