<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><version>2.7.0</version></dependency>
package com.example.redismonitor;import com.example.redismonitor.RedisInterface;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.*;@RestController@RequestMapping("/redis")public class RedisController {@Autowiredprivate RedisInterface redisService;//- - - - - - - - - - - - - - - - - - - - - string - - - - - - - - - - - - - - - - - - - -@PostMapping("/set")public String setValue(@RequestParam String key, @RequestParam String value) {redisService.set(key, value);return "Value set successfully";}@GetMapping("/get")public Object getValue(@RequestParam String key) {return redisService.get(key);}//- - - - - - - - - - - - - - - - - - - - - set - - - - - - - - - - - - - - - - - - - -@PostMapping("/sadd")public String sadd(@RequestParam String key, @RequestParam Object value) {redisService.sadd(key, value);return "Value sadd successfully";}@GetMapping("/srem")public Object srem(@RequestParam String key,@RequestParam Object... values) {return redisService.srem(key, values);}@GetMapping("/sismember")public Object sismember(@RequestParam String key,@RequestParam Object value) {return redisService.sismember(key, value);}//- - - - - - - - - - - - - - - - - - - - - hash - - - - - - - - - - - - - - - - - - - -@PostMapping("/hset")public String hset(@RequestParam String key, @RequestParam String field, @RequestParam Object value) {redisService.hset(key, field, value);return "Value hset successfully";}@GetMapping("/hget")public Object hget(@RequestParam String key, @RequestParam String field) {return redisService.hget(key, field);}//- - - - - - - - - - - - - - - - - - - - - list - - - - - - - - - - - - - - - - - - - -@PostMapping("/lpush")public String lpush(@RequestParam String key, @RequestParam Object value) {redisService.lpush(key, value);return "Value lpush successfully";}@PostMapping("/rpush")public String rpush(@RequestParam String key, @RequestParam Object value) {redisService.rpush(key, value);return "Value rpush successfully";}@GetMapping("/lpop")public Object lpop(@RequestParam String key) {return redisService.lpop(key);}@GetMapping("/rpop")public Object rpop(@RequestParam String key) {return redisService.rpop(key);}//- - - - - - - - - - - - - - - - - - - - - zset - - - - - - - - - - - - - - - - - - - -@PostMapping("/zadd")public String zadd(@RequestParam String key, @RequestParam Object value, @RequestParam double score) {redisService.zadd(key, value, score);return "Value zadd successfully";}@GetMapping("/zrank")public Object zrank(@RequestParam String key, @RequestParam Object value) {return redisService.zrank(key, value);}}

Feedback