<p>The problem found is that the cache_fetch function returns -2 in case MemCached does not respond and in case where MemCached returns an empty value. In such case, we are not able to distinct between ERROR and Empty value so the following script is not working</p>

<p>$var(mc_first)=cache_fetch("memcached:first","$avp(num)",$avp(net));</p>

<p>if($var(mc_first)==-2)<br>
{<br>
    $var(mc_second)=cache_fetch("memcached:second","$avp(num)",$avp(net));</p>

<pre><code>if($var(mc_second)==-2)
{
      avp_db_query("$avp(num)","$avp(net)","1");
 }
</code></pre>

<p>}</p>

<p>OpenSIPs 2.1</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/522">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciSAgXHcfMtA14-2sfG46OeEsLkorks5oNLj_gaJpZM4EqqCF.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/522"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>