Skip to content

Commit 26d10e6

Browse files
Mixficsolwuxianrong
andauthored
Solution The set command cache does not take effect (#3024)
Co-authored-by: wuxianrong <[email protected]>
1 parent 4f91cae commit 26d10e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pika_kv.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void SetCmd::DoUpdateCache() {
111111
}
112112
if (s_.ok()) {
113113
if (has_ttl_) {
114-
db_->cache()->Setxx(key_, value_, ttl_millsec / 1000);
114+
db_->cache()->Setxx(key_, value_, ttl_millsec > 0 ? ttl_millsec / 1000 : ttl_millsec);
115115
} else {
116116
db_->cache()->SetxxWithoutTTL(key_, value_);
117117
}
@@ -191,7 +191,7 @@ void GetCmd::DoUpdateCache() {
191191
return;
192192
}
193193
if (s_.ok()) {
194-
db_->cache()->WriteKVToCache(key_, value_, ttl_millsec_ / 1000);
194+
db_->cache()->WriteKVToCache(key_, value_, ttl_millsec_ > 0 ? ttl_millsec_ / 1000 : ttl_millsec_);
195195
}
196196
}
197197

0 commit comments

Comments
 (0)