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.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/plugin/cache/setup.go b/plugin/cache/setup.go
index d936db895..bae4c3d95 100644
--- a/plugin/cache/setup.go
+++ b/plugin/cache/setup.go
@@ -41,10 +41,7 @@ func cacheParse(c *caddy.Controller) (*Cache, error) {
j++
// cache [ttl] [zones..]
- origins := make([]string, len(c.ServerBlockKeys))
- copy(origins, c.ServerBlockKeys)
args := c.RemainingArgs()
-
if len(args) > 0 {
// first args may be just a number, then it is the ttl, if not it is a zone
ttl, err := strconv.Atoi(args[0])
@@ -57,10 +54,8 @@ func cacheParse(c *caddy.Controller) (*Cache, error) {
ca.nttl = time.Duration(ttl) * time.Second
args = args[1:]
}
- if len(args) > 0 {
- copy(origins, args)
- }
}
+ origins := plugin.OriginsFromArgsOrServerBlock(args, c.ServerBlockKeys)
// Refinements? In an extra block.
for c.NextBlock() {
@@ -189,11 +184,7 @@ func cacheParse(c *caddy.Controller) (*Cache, error) {
}
}
- for i := range origins {
- origins[i] = plugin.Host(origins[i]).Normalize()
- }
ca.Zones = origins
-
ca.pcache = cache.New(ca.pcap)
ca.ncache = cache.New(ca.ncap)
}