<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="Up" href="Ocsigen_cache.Make.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Ocsigen_cache" rel="Chapter" href="Ocsigen_cache.html"> <link title="Ocsigen_lib_base" rel="Chapter" href="Ocsigen_lib_base.html"> <link title="Ocsigen_lib" rel="Chapter" href="Ocsigen_lib.html"> <link title="Ocsigen_config" rel="Chapter" href="Ocsigen_config.html"> <link title="Ocsigen_getcommandline" rel="Chapter" href="Ocsigen_getcommandline.html"> <link title="Ocsigen_messages" rel="Chapter" href="Ocsigen_messages.html"> <link title="Ocsigen_stream" rel="Chapter" href="Ocsigen_stream.html"> <link title="Ocsigen_loader" rel="Chapter" href="Ocsigen_loader.html"> <link title="Polytables" rel="Chapter" href="Polytables.html"> <link title="Http_headers" rel="Chapter" href="Http_headers.html"> <link title="Ocsigen_http_frame" rel="Chapter" href="Ocsigen_http_frame.html"> <link title="Ocsigen_headers" rel="Chapter" href="Ocsigen_headers.html"> <link title="Framepp" rel="Chapter" href="Framepp.html"> <link title="Ocsigen_http_com" rel="Chapter" href="Ocsigen_http_com.html"> <link title="Ocsigen_charset_mime" rel="Chapter" href="Ocsigen_charset_mime.html"> <link title="Ocsigen_senders" rel="Chapter" href="Ocsigen_senders.html"> <link title="Ocsigen_cookies" rel="Chapter" href="Ocsigen_cookies.html"> <link title="Ocsigen_extensions" rel="Chapter" href="Ocsigen_extensions.html"> <link title="Ocsigen_parseconfig" rel="Chapter" href="Ocsigen_parseconfig.html"> <link title="Ocsigen_http_client" rel="Chapter" href="Ocsigen_http_client.html"> <link title="Ocsigen_local_files" rel="Chapter" href="Ocsigen_local_files.html"> <link title="Ocsigen_server" rel="Chapter" href="Ocsigen_server.html"> <link title="Ocsigen_comet" rel="Chapter" href="Ocsigen_comet.html"> <link title="Accesscontrol" rel="Chapter" href="Accesscontrol.html"> <link title="Authbasic" rel="Chapter" href="Authbasic.html"> <link title="Ocsipersist" rel="Chapter" href="Ocsipersist.html"><title>Ocsigen_cache.Make.cache</title> </head> <body> <div class="navbar"> <a class="up" href="Ocsigen_cache.Make.html" title="Ocsigen_cache.Make">Up</a> </div> <h1>Class <a href="type_Ocsigen_cache.Make.cache.html">Ocsigen_cache.Make.cache</a></h1> <pre><span name="TYPEcache"><span class="keyword">class</span> cache</span> : <code class="type">(A.key -> A.value Lwt.t) -> ?timer:float -> int -> </code><code class="code">object</code> <a href="Ocsigen_cache.Make.cache-c.html">..</a> <code class="code">end</code></pre><div class="info class top"> <code class="code">new cache finder ?timer size</code> creates a cache object where <code class="code">finder</code> is the function responsible for retrieving non-cached data, <code class="code">timer</code> (if any) is the life span of cached values (in seconds) (values in the cache are removed after their time is up) and <code class="code">size</code> is the upper bound to the number of simultaneoulsy cached elements. <p> Whenever a value is found (using <code class="code">find</code> method), it's lifespan is set to <code class="code">timer</code> (or not if the cache is not time bounded). If the value was already cached, it's lifespan is reset to <code class="code">timer</code>. <p> Using <code class="code">timer</code> allow one to create a cache bounded both in space and time. It is to be noted that real lifespan of values is always slightly greater than <code class="code">timer</code>.<br> </div> <hr width="100%"> <pre><span id="METHODfind"><span class="keyword">method</span> find</span> : <code class="type">A.key -> A.value Lwt.t</code></pre><div class="info "> Find the cached value associated to the key, or binds this value in the cache using the function <code class="code">finder</code> passed as argument to <code class="code">create</code>, and returns this value<br> </div> <pre><span id="METHODfind_in_cache"><span class="keyword">method</span> find_in_cache</span> : <code class="type">A.key -> A.value</code></pre><div class="info "> Find the cached value associated to the key. Raises <code class="code">Not_found</code> if the key is not present in the cache<br> </div> <pre><span id="METHODremove"><span class="keyword">method</span> remove</span> : <code class="type">A.key -> unit</code></pre> <pre><span id="METHODadd"><span class="keyword">method</span> add</span> : <code class="type">A.key -> A.value -> unit</code></pre> <pre><span id="METHODclear"><span class="keyword">method</span> clear</span> : <code class="type">unit -> unit</code></pre> <pre><span id="METHODsize"><span class="keyword">method</span> size</span> : <code class="type">int</code></pre></body></html>