You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
sebarys
changed the title
cachingF cached results
cachingF result caching based on predicate
Aug 22, 2018
sebarys
changed the title
cachingF result caching based on predicate
cachingF: conditionally cache based on function evaluation result type
Aug 22, 2018
I'm afraid this kind of conditional logic isn't possible with cachingF. You can do it by implementing the logic yourself using get and put, as shown in this gist.
A few people have asked similar questions before. Maybe the demand is high enough to warrant adding new combinators to the library to take care of this for you:
Alternatively you could achieve what you want by using EitherT from Cats or Scalaz. Your F[_] type would be EitherT[Future, MyError, ?]. But EitherT is not supported out of the box by ScalaCache, so you'd need to implement a new Mode for it.
Hello,
I want use cache to store token evaluations for given client credentials:
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
The text was updated successfully, but these errors were encountered: