Skip to content

Instantly share code, notes, and snippets.

@giter
giter / cache.py
Last active August 29, 2015 14:05
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())
package main
import (
"bufio"
"net/http"
"log"
)
func handler(w http.ResponseWriter, r *http.Request) {