aboutsummaryrefslogtreecommitdiff
path: root/nvdmirror/cache.go
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2022-02-22 19:59:26 -0500
committerPaul Duncan <pabs@pablotron.org>2022-02-22 19:59:26 -0500
commita4b802d22fa0940fd1862f2176dfb41f4a1be973 (patch)
tree5171b7fac94031ee9eba208a4afc25c125d2b963 /nvdmirror/cache.go
parent041f114958746a29121ec9e8b0672ca8a9a701d1 (diff)
downloadcvez-a4b802d22fa0940fd1862f2176dfb41f4a1be973.tar.bz2
cvez-a4b802d22fa0940fd1862f2176dfb41f4a1be973.zip
add nvdmirror, including cache iface, jsoncache impl, Sync() func, and test data
Diffstat (limited to 'nvdmirror/cache.go')
-rw-r--r--nvdmirror/cache.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/nvdmirror/cache.go b/nvdmirror/cache.go
new file mode 100644
index 0000000..d65b2c7
--- /dev/null
+++ b/nvdmirror/cache.go
@@ -0,0 +1,22 @@
+package nvdmirror
+
+import (
+ "time"
+)
+
+// Cache entry
+type Entry struct {
+ // time that entry was set
+ Time time.Time `json:"time"`
+ Headers map[string]string `json:"headers"`
+}
+
+// URL cache
+type Cache interface {
+ Get(string) (map[string]string, bool)
+ Set(string, map[string]string) error
+
+ // delete cache entry
+ Delete(string) error
+ Close() error // save and close cache file
+}