Skip to content

Commit

Permalink
Rename builder method
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnsk committed Jan 25, 2021
1 parent 40ee628 commit dbb0538
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ func New() Builder {
}
}

// WithAfterEviction specifies an asynchronous eviction callback.
func (build Builder) WithAfterEviction(cb EvictionCallback) Builder {
// WithEvictionCallback specifies an asynchronous eviction callback.
func (build Builder) WithEvictionCallback(cb EvictionCallback) Builder {
return func(c *Cache) {
build(c)

Expand Down
10 changes: 5 additions & 5 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var _ = Describe("autoexpiry", func() {
BeforeEach(func() {
evicted = make(chan bool)
c = evcache.New().
WithAfterEviction(func(_, _ interface{}) {
WithEvictionCallback(func(_, _ interface{}) {
defer GinkgoRecover()
close(evicted)
}).
Expand Down Expand Up @@ -169,7 +169,7 @@ var _ = Describe("eviction callback", func() {
BeforeEach(func() {
evicted = make(chan uint64, 2)
c = evcache.New().
WithAfterEviction(func(_, value interface{}) {
WithEvictionCallback(func(_, value interface{}) {
defer GinkgoRecover()
evicted <- value.(uint64)
}).
Expand Down Expand Up @@ -255,7 +255,7 @@ var _ = Describe("repeatedly setting the same key", func() {

BeforeEach(func() {
c = evcache.New().
WithAfterEviction(func(_, _ interface{}) {
WithEvictionCallback(func(_, _ interface{}) {
defer GinkgoRecover()
atomic.AddUint64(&evicted, 1)
}).
Expand Down Expand Up @@ -302,7 +302,7 @@ var _ = Describe("overflow when setting values", func() {
BeforeEach(func() {
evicted = 0
c = evcache.New().
WithAfterEviction(func(_, _ interface{}) {
WithEvictionCallback(func(_, _ interface{}) {
defer GinkgoRecover()
atomic.AddUint64(&evicted, 1)
}).
Expand Down Expand Up @@ -414,7 +414,7 @@ var _ = Describe("eventual overflow eviction order", func() {
evictedKeys = make(chan uint64, n*warmupRounds)
key = 0
c = evcache.New().
WithAfterEviction(func(key, _ interface{}) {
WithEvictionCallback(func(key, _ interface{}) {
defer GinkgoRecover()
evictedKeys <- key.(uint64)
}).
Expand Down

0 comments on commit dbb0538

Please sign in to comment.