@@ -291,10 +291,64 @@ modparam("sql_cacher", "bigint_to_str", 1)
291291</section >
292292
293293<section id =" exported_functions" xreflabel =" exported_functions" >
294- <title >Exported Functions</title >
295- <para >
296- No function exported to be used from configuration file.
297- </para >
294+ <title >Exported Functions</title >
295+ <section id =" func_sql_cache_dump" xreflabel =" sql_cache_dump()" >
296+ <title >
297+ <function moreinfo =" none" >sql_cache_dump(caching_id, columns, result_avps)</function >
298+ </title >
299+ <para >
300+ Dump all <emphasis >columns</emphasis > cached within the given <emphasis >caching_id</emphasis >,
301+ and write them to their respective <emphasis >result_avps</emphasis >.
302+ </para >
303+
304+ <para >Parameters:</para >
305+ <itemizedlist >
306+ <listitem ><para >
307+ <emphasis >caching_id</emphasis > (string) - Identifier for the SQL cache
308+ </para ></listitem >
309+ <listitem ><para >
310+ <emphasis >columns</emphasis > (string) - the desired SQL columns to be dumped,
311+ specified as comma-separated values
312+ </para ></listitem >
313+ <listitem ><para >
314+ <emphasis >result_avps</emphasis > (string) - comma-separated list of AVPs where
315+ the results will be written to
316+ </para ></listitem >
317+ </itemizedlist >
318+
319+ <para >Return Codes:</para >
320+ <itemizedlist >
321+ <listitem ><para >
322+ <emphasis role =' bold' >-1</emphasis > - Internal Error
323+ </para ></listitem >
324+ <listitem ><para >
325+ <emphasis role =' bold' >-2</emphasis > - Zero Results Returned
326+ </para ></listitem >
327+ <listitem ><para >
328+ <emphasis role =' bold' >1, 2, 3, ...</emphasis > - Number of results returned into each output AVP
329+ </para ></listitem >
330+ </itemizedlist >
331+
332+
333+ <para >
334+ This function can be used from any route.
335+ </para >
336+ <example >
337+ <title ><function moreinfo =" none" >sql_cache_dump</function > usage</title >
338+ <programlisting format =" linespecific" >
339+ ...
340+ # Example of pulling all cached CNAM records
341+ $var(n) = sql_cache_dump("cnam", "caller,callee,calling_name,fraud_score",
342+ "$avp(caller),$avp(callee),$avp(cnam),$avp(fraud)");
343+ $var(i) = 0;
344+ while ($var(i) < $var(n)) {
345+ xlog("Caller $(avp(caller)[$var(i)]) has CNAM $(avp(cnam)[$var(i)])\n");
346+ $var(i) += 1;
347+ }
348+ ...
349+ </programlisting >
350+ </example >
351+ </section >
298352</section >
299353
300354<section id =" exported_mi_functions" xreflabel =" Exported MI Functions" >
0 commit comments