Updated redis for set ops
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sambo Chea 2022-04-11 12:43:01 +07:00
parent 8c999a9e7c
commit f41b667b6c
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490

View File

@ -20,12 +20,11 @@ class RedisController @Autowired constructor(
return redisTemplate.opsForValue().multiGet(listOf(key)) ?: listOf()
}
@PostMapping("/{key}")
@PostMapping
fun set(
@PathVariable("key") key: String,
@RequestBody body: RedisKVModel
): RedisKVModel {
redisTemplate.opsForValue().set(key, body)
redisTemplate.opsForValue().set(body.key ?: throw IllegalArgumentException("Key is required"), body)
return body
}
}