Open
Description
Hello,
I want use cache to store token evaluations for given client credentials:
def fetchToken(clientCredentials: ClientCredentials): Future[Either[MyError, Token]] = {
import scala.concurrent.ExecutionContext.Implicits.global
import scalacache.modes.scalaFuture._
cachingF(clientCredentials)(ttl = Some(cacheConfig.cachingTime)) {
defaultTokenRepository.fetchToken(clientCredentials)
}
}
I want to cache only Future(Right()) results.
Future.failed an Future(Left()) result shouldn't be cached and evaluated in next function call again.
Is there any way to provide logic which result of function evaluation should be stored in the cache?
Thank you for any suggestions!
Regards,
Sebastian
Metadata
Metadata
Assignees
Labels
No labels