feat: cached token by key/ip

This commit is contained in:
Zheng Kai
2023-09-06 11:01:15 +08:00
parent 39fc4c28d6
commit 43f957dca4
8 changed files with 98 additions and 12 deletions

View File

@@ -5,13 +5,12 @@ import (
"net/http"
"project/pb"
"project/util"
"strings"
)
func (c *Core) getAB(p *pb.Req, r *http.Request) (ab []byte, cached bool, pr *row, err error) {
canCache := p.Method != http.MethodGet && p.Method != http.MethodDelete
if strings.Contains(r.Header.Get(`Authorization`), `no-cache`) {
if util.KeyNoCache(r.Header.Get(`Authorization`)) {
canCache = false
}