Use akyoto/cache

This commit is contained in:
2019-05-11 23:12:36 +09:00
parent 68859b71cf
commit d2e797f211
5 changed files with 21 additions and 17 deletions

View File

@ -1,8 +1,17 @@
package middleware
// import (
// "strings"
// "time"
// "github.com/aerogo/aero"
// "github.com/akyoto/cache"
// "github.com/animenotifier/notify.moe/utils"
// )
// const requestThreshold = 10
// var ipToStats = cache.New(15*time.Minute, 15*time.Minute)
// var ipToStats = cache.New(15 * time.Minute)
// // IPStats captures the statistics for a single IP.
// type IPStats struct {
@ -31,7 +40,7 @@ package middleware
// Requests: []string{},
// }
// ipToStats.Set(ip, stats, cache.DefaultExpiration)
// ipToStats.Set(ip, stats, 15*time.Minute)
// }
// // Add requested URI to the list of requests