Cache.has
Cache.has($key) -> boolean
Description
Returns true
if the key exists and has not yet expired.
Full example:
fun getPostsForUser($userId) { $key = 'posts:' ~ $userId if Cache.has($key) { return Cache.get($key) } // The time-consuming operation to be cached $posts = getPostsFromDb($userId) Cache.set($key, $posts, '8 hours') return $posts }