From 6d5a0600133a41c3c8ac0d6bc22f9a9362d7cd8e Mon Sep 17 00:00:00 2001 From: J S <49557684+svilupp@users.noreply.github.com> Date: Fri, 12 Jul 2024 08:57:20 +0200 Subject: [PATCH] change default --- CHANGELOG.md | 2 +- src/CacheLayer.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ff9c25..a218af3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added a launcher function `launch` to make it easier to launch the app. -- Semantic caching enabled by SemanticCaches.jl. You can change it by setting `cached=false` in the `launch()` function. +- Semantic caching enabled by SemanticCaches.jl. You can change it by setting `cached=false` in the `launch()` function (minimum similarity for cache hit is 0.99). ### Fixed - Fixed a bug when caching would error for certain types of HTTP body (eg, `IOBuffer`) diff --git a/src/CacheLayer.jl b/src/CacheLayer.jl index 7124619..d2639bd 100644 --- a/src/CacheLayer.jl +++ b/src/CacheLayer.jl @@ -59,7 +59,8 @@ function cache_layer(handler) VERBOSE && @info "Check if we can cache this request ($(length(input)) chars)" active_cache = length(input) > 5000 ? HASH_CACHE : SEM_CACHE - item = active_cache(cache_key, input; verbose = 2 * VERBOSE) # change verbosity to 0 to disable detailed logs + item = active_cache( + cache_key, input; verbose = 2 * VERBOSE, min_similarity = 0.99) # change verbosity to 0 to disable detailed logs if !isvalid(item) VERBOSE && @info "Cache miss! Pinging the API" # pass the request along to the next layer by calling `cache_layer` arg `handler`