aosasona / chimney

A minimal & fast static file server designed for minimal configuration
Apache License 2.0
6 stars 2 forks source link

feat: implement cache rules #13

Open aosasona opened 8 months ago

aosasona commented 8 months ago

The user should be able to control the default caching duration for specific file formats and paths even. Still unsure what that will look like but this is my current thought:

[cache_rules]
"*.png|*.jpg" = { duration = 30, exclude_dir = ["something"] } # where duration is `time to live`  (better term instead of duration) and 30 is in seconds
"/path/*" = 30 # matches /path/foo, /path/bar etc
"/exact-path" = 100 # strictly matches /exact-path

In code, extension-based cache rules and path-based cache rules will be handled separately.