Skip to content

Commit

Permalink
Merge pull request ipfs/go-ipfs-blockstore#20 from ipfs/fix/use-2q
Browse files Browse the repository at this point in the history
cache: switch to 2q

This commit was moved from ipfs/go-ipfs-blockstore@4733550
  • Loading branch information
Stebalien committed Aug 20, 2019
2 parents ea3c527 + d507153 commit 65c2816
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
18 changes: 0 additions & 18 deletions blockstore/Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions blockstore/arc_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ type cacheSize int
// block Cids. This provides block access-time improvements, allowing
// to short-cut many searches without query-ing the underlying datastore.
type arccache struct {
arc *lru.ARCCache
arc *lru.TwoQueueCache
blockstore Blockstore

hits metrics.Counter
total metrics.Counter
}

func newARCCachedBS(ctx context.Context, bs Blockstore, lruSize int) (*arccache, error) {
arc, err := lru.NewARC(lruSize)
arc, err := lru.New2Q(lruSize)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion blockstore/bloom_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (b *bloomcache) Has(k cid.Cid) (bool, error) {
}

func (b *bloomcache) GetSize(k cid.Cid) (int, error) {
return b.blockstore.GetSize(k)
return b.blockstore.GetSize(k)
}

func (b *bloomcache) Get(k cid.Cid) (blocks.Block, error) {
Expand Down

0 comments on commit 65c2816

Please sign in to comment.