Rename the main module to gotea.dev and the binary to gotea, and update the application name and English locale. Keep the external gitea.dev/sdk and gitea.dev/actionslib module imports unchanged. Assisted-by: OpenCode:DeepSeek-V4.1-Flash
24 lines
497 B
Go
24 lines
497 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package auth
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"gotea.dev/modules/setting"
|
|
|
|
lru "github.com/hashicorp/golang-lru/v2"
|
|
)
|
|
|
|
type TokenCacheItem struct {
|
|
TokenID int64
|
|
TokenHash string
|
|
}
|
|
|
|
var TokenCache = sync.OnceValue(func() *lru.Cache[string, *TokenCacheItem] {
|
|
cacheSize := max(setting.SuccessfulTokensCacheSize, 20)
|
|
c, _ := lru.New[string, *TokenCacheItem](cacheSize) // it only fails when size <= 0
|
|
return c
|
|
})
|