about summary refs log tree commit diff
path: root/server.go
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-09-23 14:15:46 +0200
committerEmile <hanemile@protonmail.com>2019-09-23 14:15:46 +0200
commitb7c312b2f8b01c957df4c3f077d4dc990d4350e5 (patch)
tree21e92a7bc25c114b3274500d86a74599a517f168 /server.go
parent4443b942b080c7a27a87e3f9660835a4504fed77 (diff)
implemented caching
Diffstat (limited to 'server.go')
-rw-r--r--server.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/server.go b/server.go
index 49dfb2b..76085d1 100644
--- a/server.go
+++ b/server.go
@@ -14,13 +14,9 @@ var (
 	// Store a list of categories
 	categories []string
 
-	// Map a category to it's age on disk
-	// If a category is downloaded, it is added to this map with it's Unix epoch
-	// timestamp.
-	// If the category is too old, re-download it
-	// TODO: Define what "to old" acutually means and what default value it
-	// might get
-	categoryAge = make(map[string]int)
+	// Threshold defining how old a category must be before it is considered "to
+	// old" (in seconds)
+	categoryAgeThreshold int
 
 	// Define the port the server should listen on
 	port int
@@ -44,5 +40,6 @@ func main() {
 
 func initFlags() {
 	flag.IntVar(&port, "p", 8080, "the port the server should listen on")
+	flag.IntVar(&categoryAgeThreshold, "a", 10, "max category age in seconds")
 	flag.Parse()
 }