This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"net/http" | |
"log" | |
) | |
func handler(w http.ResponseWriter, r *http.Request) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
__CACHE = {} | |
def cache(ns, key, val_func=None , ttl=None): | |
if ttl is None or ttl <= 0 : | |
return val_func() | |
now = int(time.time()) |