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:
24
cache/leveldbcache/leveldbcache_test.go
vendored
Normal file
24
cache/leveldbcache/leveldbcache_test.go
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
package leveldbcache
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/cache"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDiskCache(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "cache")
|
||||
if err != nil {
|
||||
t.Fatalf("TempDir: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tempDir)
|
||||
|
||||
c, err := New(filepath.Join(tempDir, "Db"))
|
||||
if err != nil {
|
||||
t.Fatalf("New leveldb,: %v", err)
|
||||
}
|
||||
|
||||
cache.PleaseCache(t, c)
|
||||
}
|
Reference in New Issue
Block a user