<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I gave it a try though... and it works nicely (at least for directory
entries for now). I've added 3 more commands to xml_curl: cache_on,
cache_off and cache_delete_key.<br>
<br>
- cache_on - enables caching: it will store in a switch_hash_t
structure all xml strings returned by curl, using
&lt;username&gt;@&lt;realm&gt; as a key (since we're talking directory
only in this example). The same key is looked up every time the xml is
requested for that user/realm and the code returns an xml structure
created using switch_parse_xml_from_str().<br>
<br>
- cache_off - switches back to the original behavior and clears the
hash.<br>
<br>
- cache_delete_key &lt;key&gt; - will invalidate the cache entry so
that next time it is reloaded by curl.<br>
<br>
considering a 500 bytes - 1K string for each profile, you can cache
10000 user profiles in ~10M (considering we're storing the char* s)<br>
please see a sample console output,with a terminal registering every 25
seconds<br>
<br>
============================================================================<br>
<a class="moz-txt-link-abbreviated" href="mailto:freeswitch@localhost.localdomain">freeswitch@localhost.localdomain</a>&gt; 2008-09-18 18:26:19 [CONSOLE]
mod_xml_curl.c:363 xml_url_fetch() XML response is in
/tmp/d0c586a8-85d0-11dd-838c-5148f6e85b7b.tmp.xml<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:freeswitch@localhost.localdomain">freeswitch@localhost.localdomain</a>&gt; xml_curl cache_on<br>
API CALL [xml_curl(cache_on)] output:<br>
OK<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:freeswitch@localhost.localdomain">freeswitch@localhost.localdomain</a>&gt; 2008-09-18 18:26:44 [CONSOLE]
mod_xml_curl.c:245 xml_url_fetch() Key is not in cache
[<a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a>].<br>
2008-09-18 18:26:45 [CONSOLE] mod_xml_curl.c:363 xml_url_fetch() XML
response is in /tmp/e00c7ae0-85d0-11dd-838c-5148f6e85b7b.tmp.xml<br>
<br>
2008-09-18 18:27:10 [CONSOLE] mod_xml_curl.c:231 xml_url_fetch() Using
xml from cache: <a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a><br>
2008-09-18 18:27:35 [CONSOLE] mod_xml_curl.c:231 xml_url_fetch() Using
xml from cache: <a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a><br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:freeswitch@localhost.localdomain">freeswitch@localhost.localdomain</a>&gt; xml_curl cache_delete_key
<a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a><br>
2008-09-18 18:27:42 [NOTICE] mod_xml_curl.c:128 xml_curl_function()
Removing value for [<a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a>]<br>
API CALL [xml_curl(cache_delete_key <a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a>)] output:<br>
OK<br>
<br>
2008-09-18 18:28:01 [CONSOLE] mod_xml_curl.c:245 xml_url_fetch() Key is
not in cache [<a class="moz-txt-link-abbreviated" href="mailto:1039@192.168.1.225">1039@192.168.1.225</a>].<br>
2008-09-18 18:28:01 [CONSOLE] mod_xml_curl.c:363 xml_url_fetch() XML
response is in /tmp/0d729f00-85d1-11dd-838c-5148f6e85b7b.tmp.xml<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:freeswitch@localhost.localdomain">freeswitch@localhost.localdomain</a>&gt; xml_curl cache_off<br>
2008-09-18 18:28:07 [NOTICE] mod_xml_curl.c:102 xml_curl_function()
cleaning up directory cache<br>
API CALL [xml_curl(cache_off)] output:<br>
OK<br>
========================================================================<br>
<br>
<br>
cristian<br>
<br>
Anthony Minessale wrote:
<blockquote
 cite="mid:191c3a030809171841y2dfaa19arde1388dd9daa3adb@mail.gmail.com"
 type="cite">
  <div dir="ltr">if you say inhale the xml into memory and the sever
goes haywire and sends you 2 gigs out output you are in for a treat.<br>
if you can get enough call volume on one box where the disk i/o of
xml_curl even shows up on the map in relation to all the rtp etc, we've
won.<br>
  <br>
  <br>
  <div class="gmail_quote">On Wed, Sep 17, 2008 at 6:00 PM, Cristian
Talle <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:ctalle@voiceway.ca">ctalle@voiceway.ca</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">less
tickin keeps you breathin :) It'd be nice though if you could just<br>
use xml_rpc to tell FS:<br>
    <br>
/xml_update &lt;section&gt; &lt;tag&gt; &lt;tag_attr_name&gt;
&lt;tag_attr_val&gt;...,/<br>
    <br>
similar to xml_locate<br>
    <font color="#888888"><br>
Cristian<br>
    </font>
    <div>
    <div class="Wj3C7c"><br>
Brian West wrote:<br>
&gt; If you're that concerned with it.. move the tmp to a ramdisk ;) &nbsp;I<br>
&gt; thought modern hard drives could take a lickin and keep on tickin<br>
&gt;<br>
&gt; /b<br>
&gt;<br>
&gt; On Sep 17, 2008, at 5:51 PM, Cristian Talle wrote:<br>
&gt;<br>
&gt;<br>
&gt;&gt; Oh, they are but it's still HDD... I wouldn't like to see the
server<br>
&gt;&gt; die<br>
&gt;&gt; because of too much disk IO<br>
&gt;&gt; I'm trying to figure out what's the most efficient way to
handle<br>
&gt;&gt; changes<br>
&gt;&gt; in user profiles (and possibly dialplan, etc...) if order
handle<br>
&gt;&gt; thousands of users per server.<br>
&gt;&gt;<br>
&gt;&gt; Cristian<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Freeswitch-users mailing list<br>
&gt; <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
&gt; <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
    <br>
    <br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
    <a moz-do-not-send="true"
 href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>
    <a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a moz-do-not-send="true"
 href="http://lists.freeswitch.org/mailman/options/freeswitch-users"
 target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
    <a moz-do-not-send="true" href="http://www.freeswitch.org"
 target="_blank">http://www.freeswitch.org</a><br>
    </div>
    </div>
  </blockquote>
  </div>
  <br>
  <br clear="all">
  <br>
-- <br>
Anthony Minessale II<br>
  <br>
FreeSWITCH <a moz-do-not-send="true" href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>
ClueCon <a moz-do-not-send="true" href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
  <br>
AIM: anthm<br>
  <a moz-do-not-send="true"
 href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a moz-do-not-send="true"
 href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a moz-do-not-send="true" href="http://irc.freenode.net">irc.freenode.net</a>
#freeswitch<br>
  <br>
FreeSWITCH Developer Conference<br>
  <a moz-do-not-send="true"
 href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br>
  <a moz-do-not-send="true"
 href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
  <a moz-do-not-send="true"
 href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:213-799-1400<br>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Freeswitch-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a class="moz-txt-link-freetext" href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a class="moz-txt-link-freetext" href="http://www.freeswitch.org">http://www.freeswitch.org</a>
  </pre>
</blockquote>
<br>
</body>
</html>