diff --git a/bench/cpu-def.svg b/bench/cpu-def.svg
deleted file mode 100644
index 45bedc8..0000000
--- a/bench/cpu-def.svg
+++ /dev/null
@@ -1,1884 +0,0 @@
-
-
-
-
-
diff --git a/bench/cpu-gache-graph.svg b/bench/cpu-gache-graph.svg
deleted file mode 100644
index ec2304f..0000000
--- a/bench/cpu-gache-graph.svg
+++ /dev/null
@@ -1,2142 +0,0 @@
-
-
-
diff --git a/bench/cpu-gache.svg b/bench/cpu-gache.svg
deleted file mode 100644
index c4a47d7..0000000
--- a/bench/cpu-gache.svg
+++ /dev/null
@@ -1,1720 +0,0 @@
-
-
-
-
-
diff --git a/bench/cpu-gocache-graph.svg b/bench/cpu-gocache-graph.svg
deleted file mode 100644
index 70169a9..0000000
--- a/bench/cpu-gocache-graph.svg
+++ /dev/null
@@ -1,1706 +0,0 @@
-
-
-
diff --git a/bench/cpu-gocache.svg b/bench/cpu-gocache.svg
deleted file mode 100644
index 8fb8280..0000000
--- a/bench/cpu-gocache.svg
+++ /dev/null
@@ -1,1648 +0,0 @@
-
-
-
-
-
diff --git a/bench/mem-def.svg b/bench/mem-def.svg
deleted file mode 100644
index 4498820..0000000
--- a/bench/mem-def.svg
+++ /dev/null
@@ -1,695 +0,0 @@
-
-
-
-
-
diff --git a/bench/mem-gache-graph.svg b/bench/mem-gache-graph.svg
deleted file mode 100644
index e3ba9a3..0000000
--- a/bench/mem-gache-graph.svg
+++ /dev/null
@@ -1,398 +0,0 @@
-
-
-
diff --git a/bench/mem-gache.svg b/bench/mem-gache.svg
deleted file mode 100644
index 9742c9a..0000000
--- a/bench/mem-gache.svg
+++ /dev/null
@@ -1,647 +0,0 @@
-
-
-
-
-
diff --git a/bench/mem-gocache-graph.svg b/bench/mem-gocache-graph.svg
deleted file mode 100644
index 3bc0d88..0000000
--- a/bench/mem-gocache-graph.svg
+++ /dev/null
@@ -1,438 +0,0 @@
-
-
-
diff --git a/bench/mem-gocache.svg b/bench/mem-gocache.svg
deleted file mode 100644
index 460d141..0000000
--- a/bench/mem-gocache.svg
+++ /dev/null
@@ -1,723 +0,0 @@
-
-
-
-
-
diff --git a/gache.go b/gache.go
index 3b4558e..8a50e6e 100644
--- a/gache.go
+++ b/gache.go
@@ -11,6 +11,7 @@ import (
"github.com/cespare/xxhash/v2"
"github.com/kpango/fastime"
+ "github.com/pierrec/lz4"
"golang.org/x/sync/singleflight"
)
@@ -336,7 +337,7 @@ func Foreach(ctx context.Context, f func(string, interface{}, int64) bool) Gache
// Write writes all cached data to writer
func (g *gache) Write(ctx context.Context, w io.Writer) error {
- return gob.NewEncoder(w).Encode(g.ToRawMap(ctx))
+ return gob.NewEncoder(lz4.NewWriter(w)).Encode(g.ToRawMap(ctx))
}
// Write writes all cached data to writer
@@ -347,7 +348,7 @@ func Write(ctx context.Context, w io.Writer) error {
// Read reads reader data to cache
func (g *gache) Read(r io.Reader) error {
m := make(map[string]interface{})
- err := gob.NewDecoder(r).Decode(&m)
+ err := gob.NewDecoder(lz4.NewReader(r)).Decode(&m)
if err != nil {
return err
}
diff --git a/go.mod b/go.mod
index 0bb087f..d39354f 100644
--- a/go.mod
+++ b/go.mod
@@ -6,10 +6,11 @@ require (
github.com/bluele/gcache v0.0.0-20190203144525-2016d595ccb0
github.com/cespare/xxhash/v2 v2.0.0
github.com/coocood/freecache v1.0.1
- github.com/hlts2/gocache v0.0.0-20190216065548-f2b89fd577c0
+ github.com/hlts2/gocache v0.0.0-20190216063039-f2b89fd577c0
github.com/kpango/fastime v1.0.2
github.com/kpango/glg v1.2.7
github.com/patrickmn/go-cache v2.1.0+incompatible
+ github.com/pierrec/lz4 v0.0.0-20190131084431-473cd7ce01a1
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
google.golang.org/appengine v1.4.0 // indirect
)
diff --git a/go.sum b/go.sum
index 9c3b7c7..8cdb9df 100644
--- a/go.sum
+++ b/go.sum
@@ -18,12 +18,9 @@ github.com/coocood/freecache v1.0.1/go.mod h1:ePwxCDzOYvARfHdr1pByNct1at3CoKnsip
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/hlts2/gocache v0.0.0-20181007125314-e9a99e525ba1/go.mod h1:u/v6wO8kS57bViN/degQAjOX3zGWVx3VW2HOClP2Vcc=
-github.com/hlts2/gocache v0.0.0-20181209044210-78e21778d6d4 h1:yMneq5EMJ3EWjnEHnqmk2I0X/brLu+uBM0N42fCAatk=
-github.com/hlts2/gocache v0.0.0-20181209044210-78e21778d6d4/go.mod h1:F4tUovaw56AzbV8K7ET39ZhQLFP8c8bLXRIuVvHAHUg=
-github.com/hlts2/gocache v0.0.0-20190216065548-f2b89fd577c0/go.mod h1:F4tUovaw56AzbV8K7ET39ZhQLFP8c8bLXRIuVvHAHUg=
+github.com/hlts2/gocache v0.0.0-20190216063039-f2b89fd577c0 h1:NOZ1f8hBpM5aR/jhvH0yLw7ADsiK45HUu3qhjteYfEM=
+github.com/hlts2/gocache v0.0.0-20190216063039-f2b89fd577c0/go.mod h1:F4tUovaw56AzbV8K7ET39ZhQLFP8c8bLXRIuVvHAHUg=
github.com/kpango/fastime v1.0.0/go.mod h1:Y5XY5bLG5yc7g2XmMUzc22XYV1XaH+KgUOHkDvLp4SA=
-github.com/kpango/fastime v1.0.1 h1:vQEIc1BcsqoN2faGoZFw/GMGEQ1o378TXBGsejUwWqs=
-github.com/kpango/fastime v1.0.1/go.mod h1:Y5XY5bLG5yc7g2XmMUzc22XYV1XaH+KgUOHkDvLp4SA=
github.com/kpango/fastime v1.0.2 h1:yBowxbDW0qz6EcmoV6ASj4aprgmpzDIlsd+ECN2RiaU=
github.com/kpango/fastime v1.0.2/go.mod h1:Y5XY5bLG5yc7g2XmMUzc22XYV1XaH+KgUOHkDvLp4SA=
github.com/kpango/gache v1.1.0/go.mod h1:BHKRCYnJ2pRFFIJNc61KTJb3KXSzlrt/ITfgfCQJAJw=
@@ -31,6 +28,9 @@ github.com/kpango/glg v1.2.7 h1:aVnv89IIWXSFNOm93SnDQGIKF27Jzz9olieOL2b23Xc=
github.com/kpango/glg v1.2.7/go.mod h1:sEwy6Va116x0eKdbVsilHPanIrsoE9AR/9vHwdo4ytQ=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
+github.com/pierrec/lz4 v0.0.0-20190131084431-473cd7ce01a1 h1:0utzB5Mn6QyMzIeOn+oD7pjKQLjJwfM9bz6TkPPdxcw=
+github.com/pierrec/lz4 v0.0.0-20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
+github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU=
github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=