<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>When you add the values in local cache, for each value you have
to set a different key. Instead of :</tt><tt><br>
</tt><tt> </tt><tt><br>
</tt><tt> cache_store(</tt><tt><span class="pl-s"><span
class="pl-pds">"</span>local<span class="pl-pds">"</span></span></tt><tt>,
</tt><tt><span class="pl-s"><span class="pl-pds">"</span>domain<span
class="pl-pds">"</span></span></tt><tt>, </tt><tt><span
class="pl-s"><span class="pl-pds">"</span>$(avp(domains)[$var(id)])<span
class="pl-pds">"</span></span></tt><tt>)</tt><tt><span
class="pl-c">;<br>
do<br>
</span></tt><tt> cache_store(</tt><tt><span class="pl-s"><span
class="pl-pds">"</span>local<span class="pl-pds">"</span></span></tt><tt>,
</tt><tt><span class="pl-s"><span class="pl-pds">"</span>domain<span
class="pl-pds">_</span></span></tt><tt><span class="pl-s"><span
class="pl-pds"><span class="pl-s">$var(id)</span>"</span></span></tt><tt>,
</tt><tt><span class="pl-s"><span class="pl-pds">"</span>$(avp(domains)[$var(id)])<span
class="pl-pds">"</span></span></tt><tt>)</tt><span
class="pl-c"><tt>;</tt><tt><br>
</tt><tt><br>
By doing that, you add one key for each domain value.<br>
<br>
Then you can iterate and fetch from cache the </tt></span><span
class="pl-c"><tt><tt><span class="pl-s">domain<span class="pl-pds">_</span></span></tt><tt><span
class="pl-s"><span class="pl-pds"><span class="pl-s">$var(id)
until nothing is returned anymore.<br>
<br>
Regards,<br>
</span></span></span></tt></tt></span>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<div class="moz-cite-prefix">On 21.09.2016 15:00, xiaofeng wrote:<br>
</div>
<blockquote
cite="mid:CAPE2etv90+5b7q3-pD2d2YCwOAp=F31orKzvfm9+UuOpN494sQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">Hi, Bogdan,</div>
<div class="gmail_extra"><br>
> In your script, not sure if it is the indented behavior,
but when looping through the loaded AVPs, you are pushing in
cache the same key ("domain") for all the values -> this
will overwrite any previous value and you will end up storing
only the last value.</div>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">Yes, I want all values bind to the same
key. And that's the problem, I think.<br>
<br>
</div>
<div class="gmail_extra">><br>
> The second "while" loop has no sense, as a key (in cache)
has only one value (cannot be multiple).</div>
<div class="gmail_extra"><br clear="all">
Regards,</div>
<div class="gmail_extra"><br>
xiaofeng<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a moz-do-not-send="true"
href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a moz-do-not-send="true"
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</div>
</div>
</blockquote>
<br>
</body>
</html>