Revert "[#866] Use TTL for blobovnicza tree cache"
All checks were successful
DCO action / DCO (pull_request) Successful in 2m7s
Vulncheck / Vulncheck (pull_request) Successful in 3m7s
Tests and linters / Staticcheck (pull_request) Successful in 5m12s
Tests and linters / Lint (pull_request) Successful in 6m23s
Tests and linters / Tests with -race (pull_request) Successful in 7m11s
Tests and linters / gopls check (pull_request) Successful in 7m27s
Tests and linters / Tests (1.20) (pull_request) Successful in 8m5s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m22s
Build / Build Components (1.21) (pull_request) Successful in 1m41s
Build / Build Components (1.20) (pull_request) Successful in 1m56s
All checks were successful
DCO action / DCO (pull_request) Successful in 2m7s
Vulncheck / Vulncheck (pull_request) Successful in 3m7s
Tests and linters / Staticcheck (pull_request) Successful in 5m12s
Tests and linters / Lint (pull_request) Successful in 6m23s
Tests and linters / Tests with -race (pull_request) Successful in 7m11s
Tests and linters / gopls check (pull_request) Successful in 7m27s
Tests and linters / Tests (1.20) (pull_request) Successful in 8m5s
Tests and linters / Tests (1.21) (pull_request) Successful in 8m22s
Build / Build Components (1.21) (pull_request) Successful in 1m41s
Build / Build Components (1.20) (pull_request) Successful in 1m56s
This reverts commit d9cbb16bd3
.
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
46a04463b2
commit
ae5bb87e70
10 changed files with 17 additions and 55 deletions
|
@ -1,11 +1,10 @@
|
|||
package blobovniczatree
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
utilSync "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/sync"
|
||||
"github.com/hashicorp/golang-lru/v2/expirable"
|
||||
"github.com/hashicorp/golang-lru/v2/simplelru"
|
||||
)
|
||||
|
||||
|
@ -23,10 +22,14 @@ type dbCache struct {
|
|||
dbManager *dbManager
|
||||
}
|
||||
|
||||
func newDBCache(size int, ttl time.Duration, dbManager *dbManager) *dbCache {
|
||||
cache := expirable.NewLRU(size, func(_ string, evictedDB *sharedDB) {
|
||||
func newDBCache(size int, dbManager *dbManager) *dbCache {
|
||||
cache, err := simplelru.NewLRU(size, func(_ string, evictedDB *sharedDB) {
|
||||
evictedDB.Close()
|
||||
}, ttl)
|
||||
})
|
||||
if err != nil {
|
||||
// occurs only if the size is not positive
|
||||
panic(fmt.Errorf("could not create LRU cache of size %d: %w", size, err))
|
||||
}
|
||||
return &dbCache{
|
||||
cacheGuard: &sync.RWMutex{},
|
||||
cache: cache,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue