@@ -206,9 +206,7 @@ void DelCmd::DoInitial() {
206206}
207207
208208void DelCmd::Do () {
209-
210209 int64_t count = db_->storage ()->Del (keys_);
211-
212210 if (count >= 0 ) {
213211 res_.AppendInteger (count);
214212 s_ = rocksdb::Status::OK ();
@@ -228,11 +226,7 @@ void DelCmd::DoThroughDB() {
228226
229227void DelCmd::DoUpdateCache () {
230228 if (s_.ok ()) {
231- std::vector<std::string> v;
232- for (auto key : keys_) {
233- v.emplace_back (key);
234- }
235- db_->cache ()->Del (v);
229+ db_->cache ()->Del (keys_);
236230 }
237231}
238232
@@ -1228,7 +1222,6 @@ void SetrangeCmd::DoThroughDB() {
12281222
12291223void SetrangeCmd::DoUpdateCache () {
12301224 if (s_.ok ()) {
1231-
12321225 STAGE_TIMER_GUARD (cache_duration_ms, true );
12331226 db_->cache ()->SetRangeIfKeyExist (key_, offset_, value_);
12341227 }
@@ -1341,7 +1334,7 @@ void ExpireCmd::DoInitial() {
13411334}
13421335
13431336void ExpireCmd::Do () {
1344- int64_t res = db_->storage ()->Expire (key_, ttl_sec_ * 1000 );
1337+ int32_t res = db_->storage ()->Expire (key_, ttl_sec_ * 1000 );
13451338 if (res != -1 ) {
13461339 res_.AppendInteger (res);
13471340 s_ = rocksdb::Status::OK ();
@@ -1396,7 +1389,6 @@ void PexpireCmd::DoInitial() {
13961389}
13971390
13981391void PexpireCmd::Do () {
1399-
14001392 int64_t res = db_->storage ()->Expire (key_, ttl_millsec);
14011393 if (res != -1 ) {
14021394 res_.AppendInteger (res);
@@ -1452,7 +1444,7 @@ void ExpireatCmd::DoInitial() {
14521444}
14531445
14541446void ExpireatCmd::Do () {
1455- int32_t res = db_->storage ()->Expireat (key_, time_stamp_sec_ * 100 );
1447+ int32_t res = db_->storage ()->Expireat (key_, time_stamp_sec_ * 1000 );
14561448 if (res != -1 ) {
14571449 res_.AppendInteger (res);
14581450 s_ = rocksdb::Status::OK ();
@@ -1527,7 +1519,7 @@ void TtlCmd::ReadCache() {
15271519 if (timestamp == -3 ) {
15281520 res_.SetRes (CmdRes::kErrOther , " ttl internal error" );
15291521 } else if (timestamp != -2 ) {
1530- res_.AppendInteger (timestamp);
1522+ res_.AppendInteger (timestamp);
15311523 } else {
15321524 res_.SetRes (CmdRes::kCacheMiss );
15331525 }
@@ -1551,12 +1543,12 @@ void PttlCmd::Do() {
15511543 if (ttl_millsec == -3 ) {
15521544 res_.SetRes (CmdRes::kErrOther , " ttl internal error" );
15531545 } else {
1554- // mean this key not exist
1555- res_.AppendInteger (-2 );
1546+ res_.AppendInteger (ttl_millsec);
15561547 }
15571548}
15581549
15591550void PttlCmd::ReadCache () {
1551+ // redis cache don't support pttl cache, so read directly from db
15601552 DoThroughDB ();
15611553}
15621554
@@ -1602,7 +1594,8 @@ void TypeCmd::DoInitial() {
16021594 key_ = argv_[1 ];
16031595}
16041596
1605- void TypeCmd::Do () { enum storage::DataType type = storage::DataType::kNones ;
1597+ void TypeCmd::Do () {
1598+ enum storage::DataType type = storage::DataType::kNones ;
16061599 std::string key_type;
16071600 rocksdb::Status s = db_->storage ()->GetType (key_, type);
16081601 if (s.ok ()) {
0 commit comments