* Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "yr/yr.h"
int main()
{
YR::Config conf;
conf.mode = YR::Config::Mode::CLUSTER_MODE;
YR::Init(conf);
{
std::string result{"result"};
YR::KV().Set("key", result.c_str());
}
{
std::string result{"result"};
auto size = result.size() + 1;
YR::KV().Set("key", result.c_str(), size);
}
{
std::string result{"result"};
YR::KV().Set("key", result);
}
{
YR::SetParam setParam;
setParam.ttlSecond = 0;
setParam.writeMode = YR::WriteMode::NONE_L2_CACHE_EVICT;
setParam.existence = YR::ExistenceOpt::NONE;
std::string result{"result"};
YR::KV().Set("key", result.c_str(), setParam);
}
{
YR::SetParam setParam;
setParam.ttlSecond = 0;
setParam.writeMode = YR::WriteMode::NONE_L2_CACHE_EVICT;
setParam.existence = YR::ExistenceOpt::NONE;
std::string result{"result"};
auto size = result.size() + 1;
YR::KV().Set("key", result.c_str(), size, setParam);
}
{
YR::SetParam setParam;
setParam.ttlSecond = 0;
setParam.writeMode = YR::WriteMode::NONE_L2_CACHE_EVICT;
setParam.existence = YR::ExistenceOpt::NONE;
YR::KV().Set("kv-key", "kv-value", setParam);
}
{
YR::SetParamV2 setParam;
setParam.ttlSecond = 0;
setParam.writeMode = YR::WriteMode::NONE_L2_CACHE_EVICT;
setParam.existence = YR::ExistenceOpt::NONE;
setParam.cacheType = YR::CacheType::MEMORY;
std::string result{"result"};
YR::KV().Set("key", result.c_str(), setParam);
}
{
YR::SetParamV2 setParam;
setParam.ttlSecond = 0;
setParam.writeMode = YR::WriteMode::NONE_L2_CACHE_EVICT;
setParam.existence = YR::ExistenceOpt::NONE;
setParam.cacheType = YR::CacheType::MEMORY;
std::string result{"result"};
auto size = result.size() + 1;
YR::KV().Set("key", result.c_str(), size, setParam);
}
{
YR::SetParamV2 setParam;
setParam.ttlSecond = 0;
setParam.writeMode = YR::WriteMode::NONE_L2_CACHE_EVICT;
setParam.existence = YR::ExistenceOpt::NONE;
setParam.cacheType = YR::CacheType::MEMORY;
YR::KV().Set("kv-key", "kv-value", setParam);
}
return 0;
}