Skip to content

Commit 16199c5

Browse files
committed
remove ttl for cache and just use maximumSize
1 parent 9cb7b66 commit 16199c5

2 files changed

Lines changed: 0 additions & 6 deletions

File tree

media-api/app/controllers/MediaApi.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class MediaApi(
5656
// subsequent requests within the TTL window skip Bedrock entirely.
5757
private val embeddingCache: AsyncLoadingCache[String, List[Float]] = Scaffeine()
5858
.maximumSize(config.aiSearchEmbeddingCacheMaxSize)
59-
.expireAfterWrite(config.aiSearchEmbeddingCacheTtlSeconds.seconds)
6059
.buildAsyncFuture((normQuery: String) =>
6160
embedder.createQueryEmbedding(normQuery)(MarkerMap())
6261
)
@@ -684,7 +683,6 @@ class MediaApi(
684683
}
685684

686685
SearchParams.validate(searchParams).fold(
687-
// TODO: respondErrorCollection?
688686
errors => Future.successful(respondError(UnprocessableEntity, InvalidUriParams.errorKey,
689687
errors.map(_.message).mkString(", "))
690688
),

media-api/app/lib/MediaApiConfig.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,7 @@ class MediaApiConfig(resources: GridConfigResources) extends CommonConfigWithEla
7979
// Semantic search retrieves from a bounded nearest-neighbour window.
8080
// This keeps KNN query cost predictable and makes result totals explicitly capped.
8181
val aiSearchSemanticRetrievalWindow: Int = intOpt("ai.search.semanticRetrievalWindow").getOrElse(1000)
82-
83-
// Embedding cache: avoids repeated Bedrock calls for the same text query within the TTL window.
84-
// In-flight requests for the same key are also deduplicated (only one Bedrock call fires).
8582
val aiSearchEmbeddingCacheMaxSize: Int = intOpt("ai.search.embeddingCache.maxSize").getOrElse(500)
86-
val aiSearchEmbeddingCacheTtlSeconds: Int = intOpt("ai.search.embeddingCache.ttlSeconds").getOrElse(600)
8783

8884
val maybeAgencyPickQuery: Option[Query] = agencyPicksIngredients.map { ingredients =>
8985
filters.or(

0 commit comments

Comments
 (0)