aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/cache/v1.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/feed/cache/v1.go')
-rw-r--r--internal/feed/cache/v1.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/feed/cache/v1.go b/internal/feed/cache/v1.go
index 7d95d4c..17a0346 100644
--- a/internal/feed/cache/v1.go
+++ b/internal/feed/cache/v1.go
@@ -3,8 +3,10 @@ package cache
import (
"crypto/sha256"
"encoding/base64"
+ "encoding/gob"
"encoding/hex"
"fmt"
+ "io"
"sort"
"strconv"
"strings"
@@ -373,3 +375,13 @@ func filterItems(items []cachedItem) []cachedItem {
return copiedItems
}
+
+func (cache *v1Cache) load(reader io.Reader) error {
+ decoder := gob.NewDecoder(reader)
+ return decoder.Decode(cache)
+}
+
+func (cache *v1Cache) store(writer io.Writer) error {
+ encoder := gob.NewEncoder(writer)
+ return encoder.Encode(cache)
+}