From fa8162c2100ef2198b38879cc888c178e4e29185 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Thu, 7 May 2020 19:33:56 -0400 Subject: starting to structure cache checking for requests --- cache.go | 30 +++++++++++++++++++++++++++--- 1 file 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) {} -- cgit 1.4.1-2-gfad0 1440e11b68687fe0aeb7b550d5d889e622ae'>refs log blame commit diff stats
path: root/html/apps/ex8.subx.html
blob: 8cf643783e8eb41825179c0ab82293f209356bc6 (plain) (tree)
1
2
3
4
5
6
7
8
9