Skip to content

Commit 51279db

Browse files
committed
Bug fix: Resolve the issue where SetJSONWithContext fails to set when the expiration time is greater than 0.
1 parent 4abf8f5 commit 51279db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

redis_with_context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ func (m *Manager) SetJSONWithContext(ctx context.Context, key string, value any,
13851385
}
13861386

13871387
if expiration > 0 {
1388-
_, err = conn.Do("SETEX", m.Prefix+key, expiration, jsonData)
1388+
_, err = conn.Do("SET", m.prefixKey(key), jsonData, "EX", expiration)
13891389
} else {
13901390
_, err = conn.Do("SET", m.Prefix+key, jsonData)
13911391
}

0 commit comments

Comments
 (0)