get

open fun <X> get(id: String, classOf: Class<X>, callable: Callable<X>): X

Get something out of the cache. If it's not existing the callable will be called for new data which will then be stored in the cache. If something new is cached it will be stored for 3600 seconds.

Return

The cached value.

Parameters

id

The id of the cache item. Should be something unique.

classOf

The class of the value which should be cached.

callable

The callable if the cache is empty to get a new value.

<X>

The type of the value which should be cached.

Throws

Passthroughs of the callable exceptions.


open fun <X> get(id: String, classOf: Class<X>, callable: Callable<X>, validUntil: Int): X

Get something out of the cache. If it's not existing the callable will be called for new data which will then be stored in the cache.

Return

The cached value.

Parameters

id

The id of the cache item. Should be something unique.

classOf

The class of the value which should be cached.

callable

The callable if the cache is empty to get a new value.

validUntil

How long the cache should be valid. In seconds.

<X>

The type of the value which should be cached.

Throws

Passthroughs of the callable exceptions.