<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hello Xiaofeng,<br>
      <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 -&gt; this will overwrite any
      previous value and you will end up storing only the last value.<br>
      <br>
      The second "while" loop has no sense, as a key (in cache) has only
      one value (cannot be multiple).<br>
      <br>
      Regards,<br>
    </tt>
    <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 12:09, xiaofeng wrote:<br>
    </div>
    <blockquote
cite="mid:CAPE2etsrqVqjPvpyGGCk+WJC-tpsqfnPU_bpe16=dKFMKjtUAA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_quote"><br>
          <div dir="ltr"><span class="">On Tue, Sep 20, 2016 at 7:25 PM,
              Bogdan-Andrei Iancu &lt;<a moz-do-not-send="true"
                href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;
              wrote:<br>
              &gt;<br>
              &gt; Hello,<br>
              &gt;<br>
              &gt; The avp_db_query() stores the DB result (multiple
              rows with multiple columns) into a set of AVPs (kind of an
              array). See<br>
              &gt;     <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/2.2.x/avpops.html#id293973"
                target="_blank">http://www.opensips.org/html/<wbr>docs/modules/2.2.x/avpops.<wbr>html#id293973</a><br>
              &gt;<br>
              &gt; Using a while loop (see <a moz-do-not-send="true"
                href="http://www.opensips.org/Documentation/Script-Statements-2-2#toc3"
                target="_blank">http://www.opensips.org/<wbr>Documentation/Script-<wbr>Statements-2-2#toc3</a>),
              you can iterate throw all the rows, by checking the if
              $(avp(xxx)[$var(idx)]) is NULL or not (where $var(idx) is
              the variable in the while loop).<br>
              &gt;<br>
              &gt; Inside the loop, simply store the row (all the AVPs
              with that index) into cache DB .<br>
              &gt;<br>
            </span>Just a example, if I understand what you mean:
            <div><a moz-do-not-send="true"
                href="https://gist.github.com/was4444/ef203d871d5ed3b32144d41787862ac0"
                target="_blank">https://gist.github.com/<wbr>was4444/<wbr>ef203d871d5ed3b32144d41787862a<wbr>c0</a>
              <div><br>
              </div>
              <div>It seems that we cannot fetch AVPs
                use `cache_fetch("local", "attribute", $avp(values))`
                according to the document</div>
              <div><a moz-do-not-send="true"
href="https://www.opensips.org/Documentation/Script-CoreFunctions-2-2#toc4"
                  target="_blank">https://www.opensips.org/<wbr>Documentation/Script-<wbr>CoreFunctions-2-2#toc4</a></div>
              <div>
                <div><br>
                  <br>
                  Regards,<span class=""><br>
                    <br>
                    xiaofeng<br>
                    <br>
                    --<br>
                    gpg key fingerprint:<br>
                    2048R/5E63005B<br>
                    C84F 671F 70B7 7330 4726  5EC8 02BC CBA2 5E63 005B<br>
                    --<br>
                  </span><span class="">______________________________<wbr>_________________<br>
                    Users mailing list<br>
                    <a moz-do-not-send="true"
                      href="mailto:Users@lists.opensips.org"
                      target="_blank">Users@lists.opensips.org</a><br>
                    <a moz-do-not-send="true"
                      href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                      target="_blank">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
                    <div class="gmail_extra">
                    </div>
                  </span></div>
              </div>
            </div>
          </div>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div><span><font color="#888888">xiaofeng<br>
                          <br>
                          --<br>
                          gpg key fingerprint:<br>
                          2048R/5E63005B<br>
                          C84F 671F 70B7 7330 4726  5EC8 02BC CBA2 5E63
                          005B</font></span><br>
                      <span><font color="#888888">--</font></span><br>
                      <span><font color="#888888">trans-zh_cn mailing
                          list<br>
                          <a moz-do-not-send="true"
                            href="mailto:trans-zh_cn@lists.fedoraproject.org"
                            target="_blank">trans-zh_cn@lists.fedoraproject.org</a><br>
                          <a moz-do-not-send="true"
                            href="https://admin.fedoraproject.org/mailman/listinfo/trans-zh_cn"
                            target="_blank">https://admin.fedoraproject.org/mailman/listinfo/trans-zh_cn</a></font></span></div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>