diff --git a/cmd/cache.go b/cmd/cache.go index 4c67173..dced740 100644 --- a/cmd/cache.go +++ b/cmd/cache.go @@ -72,6 +72,12 @@ func (cache *fileCache) set(val []string) { } } +func (cache *fileCache) clear() { + cache.mutex.Lock() + cache.list = nil + cache.mutex.Unlock() +} + func (cache *fileCache) isEmpty() bool { cache.mutex.RLock() length := len(cache.list) @@ -152,15 +158,15 @@ func (cache *fileCache) Import(path string) error { func serveCacheClear(args []string, cache *fileCache, formats *types.Types, errorChannel chan<- error) httprouter.Handle { return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { - list, err := fileList(args, &filters{}, "", &fileCache{}, formats) + cache.clear() + + _, err := fileList(args, &filters{}, "", cache, formats) if err != nil { errorChannel <- err return } - cache.set(list) - w.Header().Set("Content-Type", "text/plain") w.Write([]byte("Ok")) diff --git a/cmd/info.go b/cmd/info.go index fd1b3ef..b291330 100644 --- a/cmd/info.go +++ b/cmd/info.go @@ -123,7 +123,7 @@ func serveIndexHtml(args []string, cache *fileCache, paginate bool) httprouter.H } if Verbose { - fmt.Printf("%s | Serve: HTML index page (%s) to %s in %s\n", + fmt.Printf("%s | SERVE: HTML index page (%s) to %s in %s\n", startTime.Format(logDate), humanReadableSize(b), realIP(r), diff --git a/cmd/root.go b/cmd/root.go index c031199..3f37114 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - ReleaseVersion string = "0.96.3" + ReleaseVersion string = "0.96.4" ) var (