remove const from default field value

This commit is contained in:
Timur Gordon
2025-08-21 11:37:11 +02:00
parent add4fb5c48
commit 26c945ed08

View File

@@ -5,15 +5,16 @@ import json
import net.http { Method }
// https://cassiomolin.com/2016/09/09/which-http-status-codes-are-cacheable/
const default_cacheable_codes = [200, 203, 204, 206, 300, 404, 405, 410, 414, 501]
const unsafe_http_methods = [Method.put, .patch, .post, .delete]
const (
default_cacheable_codes = [200, 203, 204, 206, 300, 404, 405, 410, 414, 501]
unsafe_http_methods = [Method.put, .patch, .post, .delete]
)
pub struct CacheConfig {
pub mut:
key string // as used to identity in redis
allowable_methods []Method = [.get, .head]
allowable_codes []int = default_cacheable_codes
allowable_codes []int = [200, 203, 204, 206, 300, 404, 405, 410, 414, 501] // TODO: produces v compiler error to use const
disable bool = true // default cache is not working
expire_after int = 3600 // default expire_after is 1h
match_headers bool // cache the request header to be matched later