0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-30 22:34:18 -05:00

cmd: use trie for caching files on disk (fixes #50)

This commit is contained in:
Will Norris 2015-12-07 20:20:42 -08:00
parent 11370ac826
commit 355a00f7b6

View file

@ -135,6 +135,9 @@ func diskCache(path string) *diskcache.Cache {
d := diskv.New(diskv.Options{
BasePath: path,
CacheSizeMax: *cacheSize * 1024 * 1024,
// For file "c0ffee", store file as "c0/ff/c0ffee"
Transform: func(s string) []string { return []string{s[0:2], s[2:4]} },
})
return diskcache.NewWithDiskv(d)
}