Skip to content

Commit

Permalink
feat: experimental in-memory files cache with eviction policy support (
Browse files Browse the repository at this point in the history
…static-web-server#328)

Via a new advanced configuration entry.

The feature also supports expiration policies such as Time To Live (TTL) and Time To Idle (TTI).

Admission to a cache is controlled by the Least Frequently Used (LFU) policy and the eviction from a cache is controlled by the Least Recently Used (LRU) policy.

Example:

```toml
[general]

[advanced]

[advanced.memory-cache]
# Maximum capacity entries of the memory cache-store. Default 256
capacity = 256
# Time to live in seconds of a cached file entry. Default 1h
ttl = 3600
# Time to idle in seconds of a cached file entry. Default 5min
tti = 300
# Maximum size in bytes for a file entry to be cached. Default 8MB
max-file-size = 8192
```

Note that this feature requires Rust 1.76.0 or newer.

This feature is **experimental**. However, when stabilized then a cargo feature will be available as well as a proper documentation page.
  • Loading branch information
joseluisq authored Sep 3, 2024
1 parent e67e4c4 commit 5bdfcd4
Show file tree
Hide file tree
Showing 20 changed files with 779 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/devel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
# We test against the latest and minimum Rust stable version.
- build: pinned
os: ubuntu-22.04
rust: 1.74.0
rust: 1.76.0
# Some of our release builds are generated by a nightly compiler to take
# advantage of the latest optimizations/compile time improvements.
- build: linux-musl
Expand Down
Loading

0 comments on commit 5bdfcd4

Please sign in to comment.