We used httpcache library to implement this. As it was not possible to support different policies, I mostly copied and modified it.
19 lines
296 B
Go
19 lines
296 B
Go
package diskcache
|
|
|
|
import (
|
|
"github.com/geziyor/geziyor/cache"
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestDiskCache(t *testing.T) {
|
|
tempDir, err := ioutil.TempDir("", "cache")
|
|
if err != nil {
|
|
t.Fatalf("TempDir: %v", err)
|
|
}
|
|
defer os.RemoveAll(tempDir)
|
|
|
|
cache.PleaseCache(t, New(tempDir))
|
|
}
|