aboutsummaryrefslogtreecommitdiff
path: root/plugin/cache/setup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/cache/setup.go')
-rw-r--r--plugin/cache/setup.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugin/cache/setup.go b/plugin/cache/setup.go
index 17a588885..8464c27d9 100644
--- a/plugin/cache/setup.go
+++ b/plugin/cache/setup.go
@@ -101,6 +101,17 @@ func cacheParse(c *caddy.Controller) (*Cache, error) {
return nil, fmt.Errorf("cache TTL can not be zero or negative: %d", pttl)
}
ca.pttl = time.Duration(pttl) * time.Second
+ if len(args) > 2 {
+ minpttl, err := strconv.Atoi(args[2])
+ if err != nil {
+ return nil, err
+ }
+ // Reserve < 0
+ if minpttl < 0 {
+ return nil, fmt.Errorf("cache min TTL can not be negative: %d", minpttl)
+ }
+ ca.minpttl = time.Duration(minpttl) * time.Second
+ }
}
case Denial:
args := c.RemainingArgs()
@@ -122,6 +133,17 @@ func cacheParse(c *caddy.Controller) (*Cache, error) {
return nil, fmt.Errorf("cache TTL can not be zero or negative: %d", nttl)
}
ca.nttl = time.Duration(nttl) * time.Second
+ if len(args) > 2 {
+ minnttl, err := strconv.Atoi(args[2])
+ if err != nil {
+ return nil, err
+ }
+ // Reserve < 0
+ if minnttl < 0 {
+ return nil, fmt.Errorf("cache min TTL can not be negative: %d", minnttl)
+ }
+ ca.minnttl = time.Duration(minnttl) * time.Second
+ }
}
case "prefetch":
args := c.RemainingArgs()