@@ -142,6 +142,12 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
142142 }
143143 }
144144
145+ if app .DefaultCache .GetMappingEvictionInterval () == 0 {
146+ if s .Configuration .DefaultCache .GetMappingEvictionInterval () == 0 {
147+ app .DefaultCache .TTL = configurationtypes.Duration {Duration : time .Hour }
148+ }
149+ }
150+
145151 if s .Configuration .GetDefaultCache () == nil {
146152 s .Configuration .DefaultCache = DefaultCache {
147153 AllowedHTTPVerbs : app .DefaultCache .AllowedHTTPVerbs ,
@@ -151,6 +157,7 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
151157 TTL : app .TTL ,
152158 Stale : app .Stale ,
153159 DefaultCacheControl : app .DefaultCacheControl ,
160+ MappingEvictionInterval : app .MappingEvictionInterval ,
154161 CacheName : app .CacheName ,
155162 Timeout : app .Timeout ,
156163 }
@@ -189,6 +196,9 @@ func (s *SouinCaddyMiddleware) FromApp(app *SouinApp) error {
189196 if dc .TTL .Duration == 0 {
190197 s .Configuration .DefaultCache .TTL = appDc .TTL
191198 }
199+ if dc .MappingEvictionInterval .Duration == 0 {
200+ s .Configuration .DefaultCache .MappingEvictionInterval = appDc .MappingEvictionInterval
201+ }
192202 if dc .Stale .Duration == 0 {
193203 s .Configuration .DefaultCache .Stale = appDc .Stale
194204 }
@@ -296,8 +306,9 @@ func parseCaddyfileGlobalOption(h *caddyfile.Dispenser, _ interface{}) (interfac
296306 TTL : configurationtypes.Duration {
297307 Duration : 120 * time .Second ,
298308 },
299- DefaultCacheControl : "" ,
300- CacheName : "" ,
309+ MappingEvictionInterval : configurationtypes.Duration {Duration : time .Hour },
310+ DefaultCacheControl : "" ,
311+ CacheName : "" ,
301312 },
302313 URLs : make (map [string ]configurationtypes.URL ),
303314 }
0 commit comments