This commit is contained in:
GoEdgeLab
2024-07-27 15:42:50 +08:00
parent d511145bc5
commit c19be78e0d
524 changed files with 1817 additions and 1346 deletions

View File

@@ -1,9 +1,10 @@
package ttlcache
import (
"runtime"
"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
"runtime"
)
var SharedInt64Cache = NewBigCache[int64]()

View File

@@ -1,13 +1,6 @@
package ttlcache
import (
"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
"github.com/TeaOSLab/EdgeNode/internal/utils/testutils"
"github.com/iwind/TeaGo/assert"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
timeutil "github.com/iwind/TeaGo/utils/time"
"runtime"
"runtime/debug"
"strconv"
@@ -15,6 +8,14 @@ import (
"sync/atomic"
"testing"
"time"
"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
memutils "github.com/TeaOSLab/EdgeNode/internal/utils/mem"
"github.com/TeaOSLab/EdgeNode/internal/utils/testutils"
"github.com/iwind/TeaGo/assert"
"github.com/iwind/TeaGo/rands"
"github.com/iwind/TeaGo/types"
timeutil "github.com/iwind/TeaGo/utils/time"
)
func TestNewCache(t *testing.T) {

View File

@@ -3,10 +3,11 @@
package ttlcache
import (
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
"github.com/TeaOSLab/EdgeNode/internal/utils/zero"
"sync"
"time"
"github.com/TeaOSLab/EdgeNode/internal/utils/goman"
"github.com/TeaOSLab/EdgeNode/internal/utils/zero"
)
var SharedManager = NewManager()

View File

@@ -1,9 +1,10 @@
package ttlcache
import (
"sync"
"github.com/TeaOSLab/EdgeNode/internal/utils/expires"
"github.com/TeaOSLab/EdgeNode/internal/utils/fasttime"
"sync"
)
type Piece[T any] struct {

View File

@@ -1,9 +1,10 @@
package ttlcache
import (
"github.com/iwind/TeaGo/rands"
"testing"
"time"
"github.com/iwind/TeaGo/rands"
)
func TestPiece_Add(t *testing.T) {

View File

@@ -1,13 +1,14 @@
package ttlcache_test
import (
"runtime"
"strconv"
"testing"
"github.com/TeaOSLab/EdgeNode/internal/utils/testutils"
"github.com/TeaOSLab/EdgeNode/internal/utils/ttlcache"
"github.com/TeaOSLab/EdgeNode/internal/utils/zero"
"github.com/cespare/xxhash/v2"
"runtime"
"strconv"
"testing"
)
func TestHashCollision(t *testing.T) {