mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
feat(server): implement TOUCH command (#444)
Signed-off-by: Leonardo Mello <lsvmello@gmail.com> Signed-off-by: Leonardo Mello <lsvmello@gmail.com>
This commit is contained in:
parent
becc0f38c0
commit
efd307dbb9
5 changed files with 15 additions and 3 deletions
|
@ -13,3 +13,4 @@
|
|||
* **[Ali-Akber Saifee](https://github.com/alisaifee)**
|
||||
* **[Elle Y](https://github.com/inohime)**
|
||||
* **[ATM SALEH](https://github.com/ATM-SALEH)**
|
||||
* **[Leonardo Mello](https://github.com/lsvmello)**
|
||||
|
|
|
@ -202,8 +202,8 @@ with respect to Memcached and Redis APIs.
|
|||
- [ ] PFMERGE
|
||||
|
||||
### API 3
|
||||
- [ ] Generic Family
|
||||
- [ ] TOUCH
|
||||
- [X] Generic Family
|
||||
- [X] TOUCH
|
||||
- [X] HashSet Family
|
||||
- [X] HSTRLEN
|
||||
- [X] Server Family
|
||||
|
|
|
@ -1405,6 +1405,7 @@ void GenericFamily::Register(CommandRegistry* registry) {
|
|||
<< CI{"PING", CO::FAST, -1, 0, 0, 0}.HFUNC(Ping)
|
||||
<< CI{"ECHO", CO::LOADING | CO::FAST, 2, 0, 0, 0}.HFUNC(Echo)
|
||||
<< CI{"EXISTS", CO::READONLY | CO::FAST, -2, 1, -1, 1}.HFUNC(Exists)
|
||||
<< CI{"TOUCH", CO::READONLY | CO::FAST, -2, 1, -1, 1}.HFUNC(Exists)
|
||||
<< CI{"EXPIRE", CO::WRITE | CO::FAST, 3, 1, 1, 1}.HFUNC(Expire)
|
||||
<< CI{"EXPIREAT", CO::WRITE | CO::FAST, 3, 1, 1, 1}.HFUNC(ExpireAt)
|
||||
<< CI{"PERSIST", CO::WRITE | CO::FAST, 2, 1, 1, 1}.HFUNC(Persist)
|
||||
|
|
|
@ -32,7 +32,6 @@ class GenericFamily {
|
|||
static OpResult<uint32_t> OpExists(const OpArgs& op_args, ArgSlice keys);
|
||||
|
||||
private:
|
||||
|
||||
static void Del(CmdArgList args, ConnectionContext* cntx);
|
||||
static void Ping(CmdArgList args, ConnectionContext* cntx);
|
||||
static void Exists(CmdArgList args, ConnectionContext* cntx);
|
||||
|
|
|
@ -94,6 +94,17 @@ TEST_F(GenericFamilyTest, Exists) {
|
|||
EXPECT_THAT(resp, IntArg(3));
|
||||
}
|
||||
|
||||
TEST_F(GenericFamilyTest, Touch) {
|
||||
RespExpr resp;
|
||||
|
||||
Run({"mset", "x", "0", "y", "1"});
|
||||
resp = Run({"touch", "x", "y", "x"});
|
||||
EXPECT_THAT(resp, IntArg(3));
|
||||
|
||||
resp = Run({"touch", "z", "x", "w"});
|
||||
EXPECT_THAT(resp, IntArg(1));
|
||||
}
|
||||
|
||||
TEST_F(GenericFamilyTest, Rename) {
|
||||
RespExpr resp;
|
||||
string b_val(32, 'b');
|
||||
|
|
Loading…
Reference in a new issue