From 355a00f7b600f590c8b6064cd0acba0cd4cb51ff Mon Sep 17 00:00:00 2001 From: Will Norris Date: Mon, 7 Dec 2015 20:20:42 -0800 Subject: [PATCH] cmd: use trie for caching files on disk (fixes #50) --- cmd/imageproxy/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/imageproxy/main.go b/cmd/imageproxy/main.go index 14fa7cc..ac7be3a 100644 --- a/cmd/imageproxy/main.go +++ b/cmd/imageproxy/main.go @@ -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) }