diff options
-rw-r--r-- | cache.go | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/cache.go b/cache.go index e26eed3..b15bb50 100644 --- a/cache.go +++ b/cache.go @@ -3,6 +3,7 @@ package main import ( "io/ioutil" "log" + "strings" "sync" "time" ) @@ -27,9 +28,22 @@ var cache = &cacheWrapper{ // Wraps the two cache-checking functions. // One for /, the other for various requests. func (cache *cacheWrapper) bap(requestPath string) { - switch requestPath { - case "/": + if requestPath == "/" { bapIndex() + return + } + split := strings.Split(requestPath[1:], "/") + switch split[1] { + case "osversion": + bapOSVersion(split[0]) + case "pkgs": + bapPkgs(split[0]) + case "uptime": + bapUptime(split[0]) + case "usercount": + bapUserCount(split[0]) + case "users": + bapUsers(split[0]) default: } } @@ -66,6 +80,16 @@ func bapIndex() { cache.pages["/"] = &page{ raw: bytes, - expires: time.Now().Add(5 * time.Minute), + expires: time.Now().Add(1 * time.Minute), } } + +func bapOSVersion(format string) { + +} + +func bapPkgs(format string) {} +func bapQuery(format string) {} +func bapUptime(format string) {} +func bapUserCount(format string) {} +func bapUsers(format string) {} |