Caching policies added.

We used httpcache library to implement this. As it was not possible to support different policies, I mostly copied and modified it.
This commit is contained in:
Musab Gültekin
2019-07-07 12:18:40 +03:00
parent 0d6c2a6864
commit 90d2be2210
13 changed files with 2349 additions and 16 deletions

18
cache/diskcache/diskcache_test.go vendored Normal file
View File

@ -0,0 +1,18 @@
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))
}