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

cacheable.Cache.scala Maven / Gradle / Ivy

package cacheable

import scala.concurrent.duration.Duration

trait Cache {

  /**
   * Get the value corresponding to the given key from the cache
   * @param key cache key
   * @tparam V the type of the corresponding value
   * @return the value, if there is one
   */
  def get[V](key: String): Option[V]

  /**
   * Insert the given key-value pair into the cache, with an optional Time To Live.
   * @param key cache key
   * @param value corresponding value
   * @param ttl Time To Live
   * @tparam V the type of the corresponding value
   */
  def put[V](key: String, value: V, ttl: Option[Duration]): Unit

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy