Skip to content

Commit 51e30a6

Browse files
gurudesuGeoffrey Chanjanisz
authored
Revert change to how expiration timings to calculated. (#403)
Co-authored-by: Geoffrey Chan <geoffcha@amazon.com> Co-authored-by: Tomasz Janiszewski <janiszt@gmail.com>
1 parent 5eec717 commit 51e30a6

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

bigcache_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ func TestTimingEviction(t *testing.T) {
256256
cache.Set("key", []byte("value"))
257257

258258
// when
259-
clock.set(1)
260259
cache.Set("key2", []byte("value2"))
261260
_, err := cache.Get("key")
262261

@@ -1181,7 +1180,7 @@ func TestBigCache_GetWithInfo(t *testing.T) {
11811180
name: "Expired",
11821181
clock: 5,
11831182
wantData: value,
1184-
wantResp: Response{},
1183+
wantResp: Response{EntryStatus: Expired},
11851184
},
11861185
{
11871186
name: "After Expired",

shard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (s *cacheShard) isExpired(oldestEntry []byte, currentTimestamp uint64) bool
286286
if currentTimestamp <= oldestTimestamp { // if currentTimestamp < oldestTimestamp, the result will out of uint64 limits;
287287
return false
288288
}
289-
return currentTimestamp-oldestTimestamp > s.lifeWindow
289+
return currentTimestamp-oldestTimestamp >= s.lifeWindow
290290
}
291291

292292
func (s *cacheShard) cleanUp(currentTimestamp uint64) {

0 commit comments

Comments
 (0)