<commit_before>#include <simcode/cache/redis/RedisCache.h>
#include <simcode/base/command.h>
using namespace std;
using namespace simcode;
using namespace simcode::cache;
using namespace simcode::redis;
std::string RedisCache::Get(const std::string& key)
{
    string value;
    RedisReply r = redis_->TryCommand("GET %s", key.c_str());
    if (r && r->str) value.append(r->str, r->len);
    return value;
}

void RedisCache::Set(const std::string& key,
                     const std::string& value,
                     int64_t expire)
{
    vector<vector<string>> argvs;
    argvs.push_back(command("SET")(key)(value));
    if (expire) argvs.push_back(command("EXPIRE")(key)(expire));
    redis_->TryAppendArgvs(argvs);
}

void RedisCache::Remove(const std::string& key)
{
    string value;
    RedisReply r = redis_->TryCommand("DEL %s", key.c_str());
    r.Free();
}

int64_t RedisCache::IncrBy(const std::string& key, int inc)
{
    RedisReply r = redis_->TryCommandArgv(command("INCRBY")(key)(inc));
    if (r && r->type == REDIS_REPLY_INTEGER)
        return r->integer;
    return 0;
}<commit_msg>mod redisreply<commit_after>#include <simcode/cache/redis/RedisCache.h>
#include <simcode/base/command.h>
using namespace std;
using namespace simcode;
using namespace simcode::cache;
using namespace simcode::redis;
std::string RedisCache::Get(const std::string& key)
{
    string value;
    RedisReply r(redis_->TryCommand("GET %s", key.c_str()));
    if (r && r->str) value.append(r->str, r->len);
    return value;
}

void RedisCache::Set(const std::string& key,
                     const std::string& value,
                     int64_t expire)
{
    vector<vector<string>> argvs;
    argvs.push_back(command("SET")(key)(value));
    if (expire) argvs.push_back(command("EXPIRE")(key)(expire));
    redis_->TryAppendArgvs(argvs);
}

void RedisCache::Remove(const std::string& key)
{
    string value;
    RedisReply r(redis_->TryCommand("DEL %s", key.c_str()));
    r.Free();
}

int64_t RedisCache::IncrBy(const std::string& key, int inc)
{
    RedisReply r(redis_->TryCommandArgv(command("INCRBY")(key)(inc)));
    if (r && r->type == REDIS_REPLY_INTEGER)
        return r->integer;
    return 0;
}
{'fraction_non_alphanumeric': 0.16244343891402716, 'fraction_numerical': 0.004524886877828055, 'mean_word_length': 4.002262443438914, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3277341', 'n_tokens_mistral': 792, 'n_tokens_neox': 776, 'n_words': 156}