Skip to content

Commit

Permalink
managable ii lru (#12023)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Sep 18, 2024
1 parent 8f5517c commit de30934
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions erigon-lib/state/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ func (v *domainVisible) returnGetFromFileCache(c *DomainGetFromFileCache) {
}

var (
iiGetFromFileCacheLimit = uint32(dbg.EnvInt("II_LRU", 4096))
iiGetFromFileCacheTrace = dbg.EnvBool("II_LRU_TRACE", false)
iiGetFromFileCacheLimit = uint32(dbg.EnvInt("II_LRU", 4096))
iiGetFromFileCacheTrace = dbg.EnvBool("II_LRU_TRACE", false)
iiGetFromFileCacheEnabled = dbg.EnvBool("II_LRU_ENABLED", true)
)

type IISeekInFilesCache struct {
Expand All @@ -104,6 +105,9 @@ type iiSeekInFilesCacheItem struct {
}

func NewIISeekInFilesCache() *IISeekInFilesCache {
if !iiGetFromFileCacheEnabled {
return nil
}
c, err := freelru.New[u128, iiSeekInFilesCacheItem](iiGetFromFileCacheLimit, u128noHash)
if err != nil {
panic(err)
Expand Down

0 comments on commit de30934

Please sign in to comment.