本文整理汇总了C++中cachedb_funcs::get方法的典型用法代码示例。如果您正苦于以下问题:C++ cachedb_funcs::get方法的具体用法?C++ cachedb_funcs::get怎么用?C++ cachedb_funcs::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cachedb_funcs
的用法示例。
在下文中一共展示了cachedb_funcs::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rl_get_counter
/* NOTE: assumes that the pipe has been locked. If fails, releases the lock */
static int rl_get_counter(str *name, rl_pipe_t * pipe)
{
str res;
unsigned int hid = RL_GET_INDEX(*name);
int new_counter;
RL_SET_PENDING(pipe);
RL_RELEASE_LOCK(hid);
if (rl_set_name(name) < 0)
return -1;
if (cdbf.get(cdbc, &rl_name_buffer, &res) < 0) {
LM_ERR("cannot retrieve key\n");
return -1;
}
if (str2sint(&res, &new_counter) < 0) {
LM_ERR("invalid value %.*s - should be integer\n", res.len, res.s);
return -1;
}
if (res.s)
pkg_free(res.s);
RL_GET_LOCK(hid);
RL_RESET_PENDING(pipe);
pipe->counter = new_counter;
return 0;
}
示例2: get_dnscache_strvalue
/* gets value from cache for the corresponding entry
* Params :
* name - what is wished to be resolved - binary IP for PTR and strings for other queries
* r_type - type of DNS query
* name_len - only used in case of PTR
*/
int get_dnscache_strvalue(char *name,int r_type,int name_len,str *res)
{
str key;
/* generate key */
key.s=create_keyname_for_record(name,r_type,name_len,&key.len);
if (key.s == NULL) {
LM_ERR("failed to create key\n");
return -1;
}
LM_DBG("gen key [%.*s]\n",key.len,key.s);
/* fetch from backend */
if (cdbf.get(cdbc, &key, res) < 0) {
LM_DBG("cannot retrieve key\n");
return -1;
}
return 0;
}