Revert LRU cache changes

This commit is contained in:
世界 2023-04-19 23:43:14 +08:00
parent d744d03d93
commit 9c6e70b7cc
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
6 changed files with 8 additions and 11 deletions

View file

@ -1,8 +1,6 @@
package tun
import (
"context"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/cache"
)
@ -11,10 +9,9 @@ type RouteMapping struct {
status *cache.LruCache[RouteSession, RouteAction]
}
func NewRouteMapping(ctx context.Context, maxAge int64) *RouteMapping {
func NewRouteMapping(maxAge int64) *RouteMapping {
return &RouteMapping{
status: cache.New(
cache.WithContext[RouteSession, RouteAction](ctx),
cache.WithAge[RouteSession, RouteAction](maxAge),
cache.WithUpdateAgeOnGet[RouteSession, RouteAction](),
cache.WithEvict[RouteSession, RouteAction](func(key RouteSession, conn RouteAction) {