Last active
May 6, 2018 06:30
-
-
Save Ozsie/059a55f7d9e42ed82a5ec2cf941b49fa to your computer and use it in GitHub Desktop.
Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping(value = ["/controller"]) | |
class Controller { | |
@Autowired lateinit var cache: Cache | |
@GetMapping(path = ["{key}"]) | |
fun getStuff(@PathVariable("key") key: String) = cache.getUUID(key) | |
} | |
@CacheConfig(cacheNames = ["map"]) | |
@Service | |
class Cache { | |
@Cacheable(value = ["map"], key = "#key") | |
fun getUUID(key: String): UUID? = UUID.randomUUID().also { println("Generated $it") } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment