[OpenSIPS-Users] Proposed change to cachedb

Brett Nemeroff brett at nemeroff.com
Wed Jul 23 16:18:36 CEST 2014


Hey All,

Using memcached..

So I've noticed that while performing a cache_fetch I can't tell the
difference between a cache failure and a NOT_FOUND. It seems the problem is
actually in cachedb.c because we do this at the end of cachedb_fetch:

    return cde->cdb_func.get(con,attr,val)<0?-1:1;


So I read this to basically say to return -1 on any failure regardless of
the failure code. This is probably because of the generalized nature of the
cache interface and since each cache backend has it's own return codes. I
get that, but that being said, I can't tell what the failure is and respond
properly.

So I changed that one return line to look more like this:

        res = cde->cdb_func.get(con,attr,val);
        if (res < 0) {
          return res;
        } else {
          return 1;
        }

Is this acceptable? Will I run into problems I'm not thinking about? The
only real problem I can see is that a specific error number on one cache
backend might mean something different on another. Obviously the only way
to really fix this would be to have each cache backend to match up it's own
backend's reply codes to a set of generic opensips cache engine reply codes
separately enumerated.

Thoughts?

Thanks,
Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140723/f7ac1f9b/attachment.htm>


More information about the Users mailing list