MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cachedb_remove

Function cachedb_remove

cachedb/cachedb.c:305–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303
304
305int cachedb_remove(str* cachedb_name, str* attr)
306{
307 cachedb_engine* cde;
308 str cde_engine,grp_name;
309 char *p;
310 cachedb_con *con;
311 int ret;
312
313 if(cachedb_name == NULL || attr == NULL)
314 {
315 LM_ERR("null arguments\n");
316 return -1;
317 }
318
319 p = memchr(cachedb_name->s,':',cachedb_name->len);
320 if (p == NULL) {
321 cde_engine = *cachedb_name;
322 grp_name.s = NULL;
323 grp_name.len = 0;
324 LM_DBG("from script [%.*s] - no grp\n",cde_engine.len,cde_engine.s);
325 } else {
326 cde_engine.s = cachedb_name->s;
327 cde_engine.len = p - cde_engine.s;
328 grp_name.s = p+1;
329 grp_name.len = cachedb_name->len - cde_engine.len -1;
330 LM_DBG("from script [%.*s] - with grp [%.*s]\n",cde_engine.len,
331 cde_engine.s,grp_name.len,grp_name.s);
332
333 }
334
335 cde = lookup_cachedb(&cde_engine);
336 if(cde == NULL)
337 {
338 LM_ERR("Wrong argument <%.*s> - no cachedb system with"
339 " this name registered\n",
340 cde_engine.len,cde_engine.s);
341 return -1;
342 }
343
344 con = cachedb_get_connection(cde,&grp_name);
345 if (con == NULL) {
346 LM_ERR("failed to get connection for grp name [%.*s] : check db_url\n",
347 grp_name.len,grp_name.s);
348 return -1;
349 }
350
351 ret = cde->cdb_func.remove(con,attr);
352 if (ret == 0)
353 ret++;
354
355 return ret;
356}
357
358int cachedb_store(str* cachedb_name, str* attr, str* val,int expires)
359{

Callers 3

w_cache_removeFunction · 0.85
mi_cacheremoveFunction · 0.85
test_cachedb_apiFunction · 0.85

Calls 2

lookup_cachedbFunction · 0.85
cachedb_get_connectionFunction · 0.85

Tested by 1

test_cachedb_apiFunction · 0.68