From 570721727893d4d8e89e320ed5cefc7729a6e3c1 Mon Sep 17 00:00:00 2001 From: Christopher Davenport Date: Wed, 24 Jun 2020 15:44:02 -0700 Subject: [PATCH] Make Age and Lifetime Private --- .../scala/io/chrisdavenport/mules/http4s/CacheItem.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/scala/io/chrisdavenport/mules/http4s/CacheItem.scala b/core/src/main/scala/io/chrisdavenport/mules/http4s/CacheItem.scala index 673cef2..2af32e0 100644 --- a/core/src/main/scala/io/chrisdavenport/mules/http4s/CacheItem.scala +++ b/core/src/main/scala/io/chrisdavenport/mules/http4s/CacheItem.scala @@ -23,12 +23,12 @@ object CacheItem { new CacheItem(date, expires, response) ) - final case class Age(val deltaSeconds: Long) extends AnyVal - object Age { + private[http4s] final case class Age(val deltaSeconds: Long) extends AnyVal + private[http4s] object Age { def of(created: HttpDate, now: HttpDate): Age = new Age(now.epochSecond - created.epochSecond) } - final case class CacheLifetime(val deltaSeconds: Long) extends AnyVal - object CacheLifetime { + private[http4s] final case class CacheLifetime(val deltaSeconds: Long) extends AnyVal + private[http4s] object CacheLifetime { def of(expires: Option[HttpDate], now: HttpDate): Option[CacheLifetime] = expires.map{expiredAt => new CacheLifetime(expiredAt.epochSecond - now.epochSecond) }