1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-25 08:59:31 -05:00

Replace ARCCache with TwoQueueCache to avoid patent issue (#16240)

Co-authored-by: Mura Li <typeless@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
Mura Li 2021-06-25 02:37:07 +08:00 committed by GitHub
parent 4cc63e9919
commit fd6b1be1b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,7 +33,7 @@ var (
once sync.Once once sync.Once
cache *lru.ARCCache cache *lru.TwoQueueCache
) )
// NewContext loads custom highlight map from local config // NewContext loads custom highlight map from local config
@ -45,7 +45,7 @@ func NewContext() {
} }
// The size 512 is simply a conservative rule of thumb // The size 512 is simply a conservative rule of thumb
c, err := lru.NewARC(512) c, err := lru.New2Q(512)
if err != nil { if err != nil {
panic(fmt.Sprintf("failed to initialize LRU cache for highlighter: %s", err)) panic(fmt.Sprintf("failed to initialize LRU cache for highlighter: %s", err))
} }