Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void setValue(String key, String value, int expire, TimeUnit timeUnit) {

@Override
public Long getExpire(String key) {
return redisTemplate.getExpire(key);
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ public void testGetExpire() {
Assert.assertTrue(expireSeconds <= 4 && expireSeconds >= 0);
}

@Test
public void testGetExpireForNonExistentKey() {
String nonExistentKey = "non_existent_key_" + System.currentTimeMillis();
Long expire = wxRedisOps.getExpire(nonExistentKey);
// For non-existent keys, getExpire should return a negative value
// In Spring Data Redis 2.x: may return null (but our implementation should handle this)
// In Spring Data Redis 3.x: returns -2
Assert.assertTrue(expire == null || expire < 0, "Non-existent key should have null or negative expiration");
}

@Test
public void testExpire() {
String key = "access_token", value = String.valueOf(System.currentTimeMillis());
Expand Down
Loading