-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* resolve conflicts * resolve conflicts * variable init * fix merge wrong * resolve conflits * resolve conflict * code format * create keyspace cmd file * add del cmd * code format * code format * delete useless files * delete useless files
- Loading branch information
1 parent
171844d
commit ed5d6ba
Showing
5 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2023-present, Qihoo, Inc. All rights reserved. | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#include "cmd_keys.h" | ||
#include "store.h" | ||
|
||
namespace pikiwidb { | ||
|
||
DelCmd::DelCmd(const std::string& name, int16_t arity) | ||
: BaseCmd(name, arity, CmdFlagsWrite, AclCategoryWrite | AclCategoryKeyspace) {} | ||
|
||
bool DelCmd::DoInitial(PClient* client) { | ||
client->SetKey(client->argv_[1]); | ||
return true; | ||
} | ||
|
||
void DelCmd::DoCmd(PClient* client) { | ||
if (PSTORE.DeleteKey(client->Key())) { | ||
PSTORE.ClearExpire(client->Key()); | ||
client->AppendInteger(1); | ||
} else { | ||
client->AppendInteger(0); | ||
} | ||
} | ||
} // namespace pikiwidb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2023-present, Qihoo, Inc. All rights reserved. | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "base_cmd.h" | ||
|
||
namespace pikiwidb { | ||
|
||
class DelCmd : public BaseCmd { | ||
public: | ||
DelCmd(const std::string& name, int16_t arity); | ||
|
||
protected: | ||
bool DoInitial(PClient* client) override; | ||
|
||
private: | ||
void DoCmd(PClient* client) override; | ||
}; | ||
|
||
} // namespace pikiwidb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,4 +456,4 @@ void SetnxCmd::DoCmd(PClient* client) { | |
} | ||
} | ||
|
||
} // namespace pikiwidb | ||
} // namespace pikiwidb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters