Skip to content

Commit

Permalink
>=
Browse files Browse the repository at this point in the history
  • Loading branch information
yujieli-temporal committed Jul 18, 2023
1 parent 9c2b0ee commit b6171a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common/cache/lru.go
Expand Up @@ -275,7 +275,7 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool)
return nil, nil
}
entrySize := getSize(value)
if entrySize >= c.maxSize {
if entrySize > c.maxSize {
return nil, ErrCacheItemTooLarge
}

Expand Down
2 changes: 1 addition & 1 deletion common/cache/lru_test.go
Expand Up @@ -355,7 +355,7 @@ func TestCache_ItemSizeTooLarge(t *testing.T) {
res := cache.Put(uuid.New(), &testEntryWithCacheSize{maxTotalBytes})
assert.Equal(t, res, nil)

res, err := cache.PutIfNotExist(uuid.New(), &testEntryWithCacheSize{maxTotalBytes})
res, err := cache.PutIfNotExist(uuid.New(), &testEntryWithCacheSize{maxTotalBytes + 1})
assert.Equal(t, err, ErrCacheItemTooLarge)
assert.Equal(t, res, nil)

Expand Down

0 comments on commit b6171a6

Please sign in to comment.