Skip to content

Commit

Permalink
Change default similarity
Browse files Browse the repository at this point in the history
  • Loading branch information
svilupp authored Jul 12, 2024
2 parents f0702da + 6d5a060 commit b57a272
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
3 changes: 2 additions & 1 deletion src/CacheLayer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit b57a272

Please sign in to comment.