diff --git a/backend.go b/backend.go index c10f1c8..eb6a77a 100644 --- a/backend.go +++ b/backend.go @@ -63,13 +63,6 @@ func (l lruBackend[K, V]) Purge() { l.Cache.Flush() } -type twoQueueBackend[K comparable, V any] struct { - *tq.Cache[K, V] - // As of Go 1.18, Go does not allow type alias of generic types, so we cannot write it like below and have to fall back - // to embedding in a struct. - // type twoQueueBackend[K comparable, V any] = *tq.Cache[K, V] -} - func new2QBackend[K comparable, V any](cap int) backend[K, V] { - return twoQueueBackend[K, V]{tq.New[K, V](cap)} + return tq.New[K, V](cap) } diff --git a/cache_test.go b/cache_test.go index 861afaa..7b91722 100644 --- a/cache_test.go +++ b/cache_test.go @@ -10,6 +10,8 @@ import ( "time" "github.com/stretchr/testify/assert" + + "github.com/motoki317/sc/tq" ) func TestNewMust(t *testing.T) { @@ -203,7 +205,7 @@ func TestNew(t *testing.T) { c, err := New[string, string](fn, 0, 0, With2QBackend(10)) assert.NoError(t, err) assert.IsType(t, &Cache[string, string]{}, c) - assert.IsType(t, twoQueueBackend[string, value[string]]{}, c.values) + assert.IsType(t, &tq.Cache[string, value[string]]{}, c.values) assert.False(t, c.strictCoalescing) }) @@ -213,7 +215,7 @@ func TestNew(t *testing.T) { c, err := New[string, string](fn, 0, 0, With2QBackend(10), EnableStrictCoalescing()) assert.NoError(t, err) assert.IsType(t, &Cache[string, string]{}, c) - assert.IsType(t, twoQueueBackend[string, value[string]]{}, c.values) + assert.IsType(t, &tq.Cache[string, value[string]]{}, c.values) assert.True(t, c.strictCoalescing) }) }