Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default similarity #18

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading