Skip to content

Commit

Permalink
variate init
Browse files Browse the repository at this point in the history
  • Loading branch information
super-Pan66 committed Nov 16, 2023
1 parent 22a9d19 commit 9501bd7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cmd_kv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SetexCmd::SetexCmd(const std::string& name, int16_t arity)

bool SetexCmd::DoInitial(PClient* client) {
client->SetKey(client->argv_[1]);
int64_t sec;
int64_t sec = 0;
if (pstd::String2int(client->argv_[2], &sec) == 0) {
client->SetRes(CmdRes::kInvalidInt);
return false;
Expand All @@ -99,7 +99,7 @@ bool SetexCmd::DoInitial(PClient* client) {

void SetexCmd::DoCmd(PClient* client) {
PSTORE.SetValue(client->argv_[1], PObject::CreateString(client->argv_[3]));
int64_t sec;
int64_t sec = 0;
pstd::String2int(client->argv_[2], &sec);
PSTORE.SetExpire(client->argv_[1], ::Now() + sec * 1000);
client->SetRes(CmdRes::kOk);
Expand All @@ -110,7 +110,7 @@ PsetexCmd::PsetexCmd(const std::string& name, int16_t arity)

bool PsetexCmd::DoInitial(PClient* client) {
client->SetKey(client->argv_[1]);
int64_t msec;
int64_t msec = 0;
if (pstd::String2int(client->argv_[2], &msec) == 0) {
client->SetRes(CmdRes::kInvalidInt);
return false;
Expand All @@ -120,7 +120,7 @@ bool PsetexCmd::DoInitial(PClient* client) {

void PsetexCmd::DoCmd(PClient* client) {
PSTORE.SetValue(client->argv_[1], PObject::CreateString(client->argv_[3]));
int64_t msec;
int64_t msec = 0;
pstd::String2int(client->argv_[2], &msec);
PSTORE.SetExpire(client->argv_[1], ::Now() + msec);
client->SetRes(CmdRes::kOk);
Expand Down

0 comments on commit 9501bd7

Please sign in to comment.