All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sup.modules.scalacache.scala Maven / Gradle / Ivy

There is a newer version: 0.9.0-M7
Show newest version
package sup.modules

import sup.{HealthCheckEndoMod, HealthResult}
import _root_.scalacache.{Cache, Flags, Mode}

import scala.concurrent.duration.Duration

object scalacache {

  /**
    * Caches a healthcheck for the given amount of time (or forever, if `ttl` is empty).
    * */
  def cached[F[_], H[_]](key: String, ttl: Option[Duration])(implicit cache: Cache[HealthResult[H]],
                                                             mode: Mode[F],
                                                             flags: Flags): HealthCheckEndoMod[F, H] = _.transform {
    action =>
      cache.cachingForMemoizeF(key)(ttl)(action)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy