/doc/core/z_memo.html

https://code.google.com/p/zotonic/ · HTML · 78 lines · 65 code · 13 blank · 0 comment · 0 complexity · 3140cb6449cf5bae787390f3fbd336e5 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Module z_memo</title>
  5. <link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6. </head>
  7. <body bgcolor="white">
  8. <div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  9. <hr>
  10. <h1>Module z_memo</h1>
  11. <ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Simple memo functions.
  12. <p>Copyright Š 2009 Marc Worrell
  13. Date: 2009-11-05
  14. </p>
  15. <p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
  16. <h2><a name="description">Description</a></h2>Simple memo functions. Stores much used values in the process dictionary. Especially useful for
  17. ACL lookups.
  18. <h2><a name="index">Function Index</a></h2>
  19. <table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#disable-0">disable/0</a></td><td>Disable memoization for this process, also cleans up the possible depcache memoization.</td></tr>
  20. <tr><td valign="top"><a href="#enable-0">enable/0</a></td><td>Enable memoization for this process.</td></tr>
  21. <tr><td valign="top"><a href="#get-1">get/1</a></td><td>Check if the key is stored.</td></tr>
  22. <tr><td valign="top"><a href="#get-2">get/2</a></td><td></td></tr>
  23. <tr><td valign="top"><a href="#is_enabled-1">is_enabled/1</a></td><td>Check if memoization is enabled for the current user/process.</td></tr>
  24. <tr><td valign="top"><a href="#set-2">set/2</a></td><td>Store a key if memoization is set.</td></tr>
  25. <tr><td valign="top"><a href="#set-3">set/3</a></td><td></td></tr>
  26. <tr><td valign="top"><a href="#set_userid-1">set_userid/1</a></td><td>Set the user id for which we memo values.</td></tr>
  27. </table>
  28. <h2><a name="functions">Function Details</a></h2>
  29. <h3 class="function"><a name="disable-0">disable/0</a></h3>
  30. <div class="spec">
  31. <p><tt>disable() -&gt; any()</tt></p>
  32. </div><p>Disable memoization for this process, also cleans up the possible depcache memoization.</p>
  33. <h3 class="function"><a name="enable-0">enable/0</a></h3>
  34. <div class="spec">
  35. <p><tt>enable() -&gt; any()</tt></p>
  36. </div><p>Enable memoization for this process. You need to call set_userid/1 before memoization is effective.</p>
  37. <h3 class="function"><a name="get-1">get/1</a></h3>
  38. <div class="spec">
  39. <p><tt>get(Key) -&gt; any()</tt></p>
  40. </div><p>Check if the key is stored.</p>
  41. <h3 class="function"><a name="get-2">get/2</a></h3>
  42. <div class="spec">
  43. <p><tt>get(Key, Context) -&gt; any()</tt></p>
  44. </div>
  45. <h3 class="function"><a name="is_enabled-1">is_enabled/1</a></h3>
  46. <div class="spec">
  47. <p><tt>is_enabled(Context) -&gt; any()</tt></p>
  48. </div><p>Check if memoization is enabled for the current user/process. Disabled when in a sudo action.</p>
  49. <h3 class="function"><a name="set-2">set/2</a></h3>
  50. <div class="spec">
  51. <p><tt>set(Key, Value) -&gt; any()</tt></p>
  52. </div><p>Store a key if memoization is set.</p>
  53. <h3 class="function"><a name="set-3">set/3</a></h3>
  54. <div class="spec">
  55. <p><tt>set(Key, Value, Context) -&gt; any()</tt></p>
  56. </div>
  57. <h3 class="function"><a name="set_userid-1">set_userid/1</a></h3>
  58. <div class="spec">
  59. <p><tt>set_userid(AuthUserId) -&gt; any()</tt></p>
  60. </div><p>Set the user id for which we memo values. Called by z_auth on session initialization.</p>
  61. <hr>
  62. <div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  63. <p><i>Generated by EDoc, Aug 12 2011, 20:01:39.</i></p>
  64. </body>
  65. </html>