<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Do you have any performance tests to show the difference?</div><div><br></div><div>Mike</div><div><br></div><br><div><div>On Sep 18, 2008, at 6:50 PM, Cristian Talle wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div 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 <username>@<realm> 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 <key> - 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>> 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>> 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>> 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>> 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>> 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></div></blockquote></div><br></body></html>