mirror of
https://github.com/willnorris/imageproxy.git
synced 2024-12-30 22:34:18 -05:00
allow specifying multiple cache with spaces
this is necessary for the new environment variable support for config values. I don't love that allowHosts is comma separated and cache is space separated :(
This commit is contained in:
parent
d8ed21c0f4
commit
fe437a0b8c
2 changed files with 15 additions and 13 deletions
10
README.md
10
README.md
|
@ -160,11 +160,11 @@ version.
|
||||||
|
|
||||||
[codercat URL]: http://localhost:8080/500/https://octodex.github.com/images/codercat.jpg
|
[codercat URL]: http://localhost:8080/500/https://octodex.github.com/images/codercat.jpg
|
||||||
|
|
||||||
If the `-cache` flag is specified multiple times, multiple caches will be
|
Multiple caches can be specified by separating them by spaces or by repeating
|
||||||
created in a [tiered fashion][]. Typically this is used to put a smaller and
|
the `-cache` flag multiple times. The caches will be created in a [tiered
|
||||||
faster in-memory cache in front of a larger but slower on-disk cache. For
|
fashion][]. Typically this is used to put a smaller and faster in-memory cache
|
||||||
example, the following will first check an in-memory cache for an image,
|
in front of a larger but slower on-disk cache. For example, the following will
|
||||||
followed by a gcs bucket:
|
first check an in-memory cache for an image, followed by a gcs bucket:
|
||||||
|
|
||||||
imageproxy -cache memory -cache gcs://my-bucket/
|
imageproxy -cache memory -cache gcs://my-bucket/
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,8 @@ func (tc *tieredCache) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tc *tieredCache) Set(value string) error {
|
func (tc *tieredCache) Set(value string) error {
|
||||||
c, err := parseCache(value)
|
for _, v := range strings.Fields(value) {
|
||||||
|
c, err := parseCache(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -132,6 +133,7 @@ func (tc *tieredCache) Set(value string) error {
|
||||||
} else {
|
} else {
|
||||||
tc.Cache = twotier.New(tc.Cache, c)
|
tc.Cache = twotier.New(tc.Cache, c)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue