mirror of https://github.com/jlelse/GoBlog
Collect garbage after cache clear and reloading router
This commit is contained in:
parent
3877507890
commit
5aa04ba366
5
cache.go
5
cache.go
|
@ -9,6 +9,7 @@ import (
|
|||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -210,6 +211,10 @@ func getCache(key string, next http.Handler, r *http.Request) (item *cacheItem)
|
|||
|
||||
func purgeCache() {
|
||||
cacheR.Clear()
|
||||
// Do manual GC
|
||||
go func() {
|
||||
runtime.GC()
|
||||
}()
|
||||
}
|
||||
|
||||
func setInternalCacheExpirationHeader(w http.ResponseWriter, expiration int) {
|
||||
|
|
Loading…
Reference in New Issue