github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/manual/mod/mod_mem_cache.html.en (about)

     1  <?xml version="1.0" encoding="ISO-8859-1"?>
     2  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     3  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
     4  <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
     5  <!--
     6          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     7                This file is generated from xml source: DO NOT EDIT
     8          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     9        -->
    10  <title>mod_mem_cache - Apache HTTP Server Version 2.2</title>
    11  <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
    12  <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
    13  <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
    14  <script src="../style/scripts/prettify.min.js" type="text/javascript">
    15  </script>
    16  
    17  <link href="../images/favicon.ico" rel="shortcut icon" /><link href="http://httpd.apache.org/docs/current/mod/mod_mem_cache.html" rel="canonical" /></head>
    18  <body>
    19  <div id="page-header">
    20  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
    21  <p class="apache">Apache HTTP Server Version 2.2</p>
    22  <img alt="" src="../images/feather.gif" /></div>
    23  <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
    24  <div id="path">
    25  <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Modules</a></div>
    26  <div id="page-content">
    27  <div class="retired"><h4>Please note</h4>
    28              <p> This document refers to a legacy release (<strong>2.2</strong>) of Apache httpd. The active release (<strong>2.4</strong>) is documented <a href="http://httpd.apache.org/docs/current">here</a>. If you have not already upgraded, please follow <a href="http://httpd.apache.org/docs/current/upgrading.html">this link</a> for more information.</p>
    29          <p>You may follow <a href="http://httpd.apache.org/docs/current/mod/mod_mem_cache.html">this link</a> to go to the current version of this document.</p></div><div id="preamble"><h1>Apache Module mod_mem_cache</h1>
    30  <div class="toplang">
    31  <p><span>Available Languages: </span><a href="../en/mod/mod_mem_cache.html" title="English">&nbsp;en&nbsp;</a> |
    32  <a href="../ja/mod/mod_mem_cache.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
    33  <a href="../ko/mod/mod_mem_cache.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
    34  </div>
    35  <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Content cache keyed to URIs</td></tr>
    36  <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
    37  <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>mem_cache_module</td></tr>
    38  <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_mem_cache.c</td></tr></table>
    39  <h3>Summary</h3>
    40  
    41      <p>This module <em>requires</em> the service of <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>. It acts as a support module for <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> and provides a memory based storage manager.
    42      <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code> can be configured to operate in two
    43      modes: caching open file descriptors or caching objects in heap storage.
    44      <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code> is most useful when used to cache locally
    45      generated content or to cache backend server content for <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> configured for <code class="directive"><a href="../mod/mod_proxy.html#proxypass">ProxyPass</a></code> (aka <dfn>reverse proxy</dfn>).</p>
    46  
    47      <p>Content is stored in and retrieved from the cache using URI based
    48      keys. Content with access protection is not cached.</p>
    49      
    50      <div class="note"><h3>Note</h3>In most cases <code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code>
    51      should be the preferred choice. This is explained further in the <a href="../caching.html#inmemory">Caching Guide</a>.  In particular,
    52      this module's cache is <em>per-process</em>, which can be partially
    53      mitigated by configuring threaded MPMs to use fewer child processes
    54      via configuration of larger values for <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>.  This module's cache is 
    55      also limited to storing a single variant (see HTTP Vary: header) of each 
    56      resource in the cache.</div>
    57  </div>
    58  <div id="quickview"><h3 class="directives">Directives</h3>
    59  <ul id="toc">
    60  <li><img alt="" src="../images/down.gif" /> <a href="#mcachemaxobjectcount">MCacheMaxObjectCount</a></li>
    61  <li><img alt="" src="../images/down.gif" /> <a href="#mcachemaxobjectsize">MCacheMaxObjectSize</a></li>
    62  <li><img alt="" src="../images/down.gif" /> <a href="#mcachemaxstreamingbuffer">MCacheMaxStreamingBuffer</a></li>
    63  <li><img alt="" src="../images/down.gif" /> <a href="#mcacheminobjectsize">MCacheMinObjectSize</a></li>
    64  <li><img alt="" src="../images/down.gif" /> <a href="#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></li>
    65  <li><img alt="" src="../images/down.gif" /> <a href="#mcachesize">MCacheSize</a></li>
    66  </ul>
    67  <h3>See also</h3>
    68  <ul class="seealso">
    69  <li><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code></li>
    70  <li><code class="module"><a href="../mod/mod_disk_cache.html">mod_disk_cache</a></code></li>
    71  </ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
    72  
    73  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
    74  <div class="directive-section"><h2><a name="MCacheMaxObjectCount" id="MCacheMaxObjectCount">MCacheMaxObjectCount</a> <a name="mcachemaxobjectcount" id="mcachemaxobjectcount">Directive</a></h2>
    75  <table class="directive">
    76  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum number of objects allowed to be placed in the
    77  cache</td></tr>
    78  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMaxObjectCount <var>value</var></code></td></tr>
    79  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMaxObjectCount 1009</code></td></tr>
    80  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
    81  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
    82  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
    83  </table>
    84      <p>The <code class="directive">MCacheMaxObjectCount</code> directive sets the
    85      maximum number of objects to be cached. The value is used to create the
    86      open hash table. If a new object needs to be inserted in the cache and
    87      the maximum number of objects has been reached, an object will be
    88      removed to allow the new object to be cached. The object to be removed
    89      is selected using the algorithm specified by <code class="directive"><a href="#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></code>.</p>
    90  
    91      <div class="example"><h3>Example</h3><p><code>
    92        MCacheMaxObjectCount 13001
    93      </code></p></div>
    94  
    95  </div>
    96  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
    97  <div class="directive-section"><h2><a name="MCacheMaxObjectSize" id="MCacheMaxObjectSize">MCacheMaxObjectSize</a> <a name="mcachemaxobjectsize" id="mcachemaxobjectsize">Directive</a></h2>
    98  <table class="directive">
    99  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum size (in bytes) of a document allowed in the
   100  cache</td></tr>
   101  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMaxObjectSize <var>bytes</var></code></td></tr>
   102  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMaxObjectSize 10000</code></td></tr>
   103  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
   104  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
   105  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
   106  </table>
   107      <p>The <code class="directive">MCacheMaxObjectSize</code> directive sets the
   108      maximum allowable size, in bytes, of a document for it to be considered
   109      cacheable.</p>
   110  
   111      <div class="example"><h3>Example</h3><p><code>
   112        MCacheMaxObjectSize 6400000
   113      </code></p></div>
   114  
   115      <div class="note"><h3>Note</h3>
   116        <p>The value of <code class="directive">MCacheMaxObjectSize</code> must be
   117        greater than the value specified by the <code class="directive"><a href="#mcacheminobjectsize">MCacheMinObjectSize</a></code> directive.</p>
   118      </div>
   119  
   120  </div>
   121  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   122  <div class="directive-section"><h2><a name="MCacheMaxStreamingBuffer" id="MCacheMaxStreamingBuffer">MCacheMaxStreamingBuffer</a> <a name="mcachemaxstreamingbuffer" id="mcachemaxstreamingbuffer">Directive</a></h2>
   123  <table class="directive">
   124  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of a streamed response to buffer in memory
   125  before declaring the response uncacheable</td></tr>
   126  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMaxStreamingBuffer <var>size_in_bytes</var></code></td></tr>
   127  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMaxStreamingBuffer the smaller of 100000 or MCacheMaxObjectSize</code></td></tr>
   128  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
   129  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
   130  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
   131  </table>
   132      <p>The <code class="directive">MCacheMaxStreamingBuffer</code> directive
   133      specifies the maximum number of bytes of a streamed response to
   134      buffer before deciding that the response is too big to cache.
   135      A streamed response is one in which the entire content is not
   136      immediately available and in which the <code>Content-Length</code>
   137      may not be known. Sources of streaming responses include proxied
   138      responses and the output of CGI scripts. By default, a streamed
   139      response will <em>not</em> be cached unless it has a
   140      <code>Content-Length</code> header. The reason for this is to
   141      avoid using a large amount of memory to buffer a partial response
   142      that might end up being too large to fit in the cache.
   143      The <code class="directive">MCacheMaxStreamingBuffer</code> directive allows
   144      buffering of streamed responses that don't contain a
   145      <code>Content-Length</code> up to the specified maximum amount of
   146      space. If the maximum buffer space is reached, the buffered
   147      content is discarded and the attempt to cache is abandoned.</p>
   148  
   149      <div class="note"><h3>Note:</h3>
   150        <p>Using a nonzero value for <code class="directive">MCacheMaxStreamingBuffer</code> 
   151        will not delay the transmission of the response to the client.
   152        As soon as <code class="module"><a href="../mod/mod_mem_cache.html">mod_mem_cache</a></code> copies a block of streamed
   153        content into a buffer, it sends the block on to the next output
   154        filter for delivery to the client.</p>
   155      </div>
   156  
   157      <div class="example"><p><code>
   158        # Enable caching of streamed responses up to 64KB:<br />
   159        MCacheMaxStreamingBuffer 65536
   160      </code></p></div>
   161  
   162  </div>
   163  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   164  <div class="directive-section"><h2><a name="MCacheMinObjectSize" id="MCacheMinObjectSize">MCacheMinObjectSize</a> <a name="mcacheminobjectsize" id="mcacheminobjectsize">Directive</a></h2>
   165  <table class="directive">
   166  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The minimum size (in bytes) of a document to be allowed in the
   167  cache</td></tr>
   168  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheMinObjectSize <var>bytes</var></code></td></tr>
   169  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheMinObjectSize 1</code></td></tr>
   170  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
   171  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
   172  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
   173  </table>
   174      <p>The <code class="directive">MCacheMinObjectSize</code> directive sets the
   175      minimum size in bytes of a document for it to be considered
   176      cacheable.</p>
   177  
   178      <div class="example"><h3>Example</h3><p><code>
   179        MCacheMinObjectSize 10000
   180      </code></p></div>
   181  
   182  </div>
   183  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   184  <div class="directive-section"><h2><a name="MCacheRemovalAlgorithm" id="MCacheRemovalAlgorithm">MCacheRemovalAlgorithm</a> <a name="mcacheremovalalgorithm" id="mcacheremovalalgorithm">Directive</a></h2>
   185  <table class="directive">
   186  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The algorithm used to select documents for removal from the
   187  cache</td></tr>
   188  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheRemovalAlgorithm LRU|GDSF</code></td></tr>
   189  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheRemovalAlgorithm GDSF</code></td></tr>
   190  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
   191  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
   192  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
   193  </table>
   194      <p>The <code class="directive">MCacheRemovalAlgorithm</code> directive specifies
   195      the algorithm used to select documents for removal from the cache.
   196      Two choices are available:</p>
   197  
   198      <dl>
   199        <dt><code>LRU</code> (Least Recently Used)</dt>
   200        <dd><code>LRU</code> removes the documents that have not been accessed
   201        for the longest time.</dd>
   202  
   203        <dt><code>GDSF</code> (GreadyDual-Size)</dt>
   204        <dd><code>GDSF</code> assigns a priority to cached documents based
   205        on the cost of a cache miss and the size of the document. Documents
   206        with the lowest priority are removed first.</dd>
   207      </dl>
   208  
   209      <div class="example"><h3>Example</h3><p><code>
   210        MCacheRemovalAlgorithm GDSF<br />
   211        MCacheRemovalAlgorithm LRU
   212      </code></p></div>
   213  
   214  </div>
   215  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   216  <div class="directive-section"><h2><a name="MCacheSize" id="MCacheSize">MCacheSize</a> <a name="mcachesize" id="mcachesize">Directive</a></h2>
   217  <table class="directive">
   218  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum amount of memory used by the cache in
   219  KBytes</td></tr>
   220  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MCacheSize <var>KBytes</var></code></td></tr>
   221  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MCacheSize 100</code></td></tr>
   222  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
   223  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
   224  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mem_cache</td></tr>
   225  </table>
   226      <p>The <code class="directive">MCacheSize</code> directive sets the maximum
   227      amount of memory to be used by the cache, in KBytes (1024-byte units).
   228      If a new object needs to be inserted in the cache and the size of the
   229      object is greater than the remaining memory, objects will be removed
   230      until the new object can be cached. The object to be removed is
   231      selected using the algorithm specified by <code class="directive"><a href="#mcacheremovalalgorithm">MCacheRemovalAlgorithm</a></code>.</p>
   232  
   233      <div class="example"><h3>Example</h3><p><code>
   234        MCacheSize 700000
   235      </code></p></div>
   236  
   237      <div class="note"><h3>Note</h3>
   238        <p>The <code class="directive">MCacheSize</code> value must be greater than
   239        the value specified by the <code class="directive"><a href="#mcachemaxobjectsize">MCacheMaxObjectSize</a></code> directive.</p>
   240      </div>
   241  
   242  </div>
   243  </div>
   244  <div class="bottomlang">
   245  <p><span>Available Languages: </span><a href="../en/mod/mod_mem_cache.html" title="English">&nbsp;en&nbsp;</a> |
   246  <a href="../ja/mod/mod_mem_cache.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
   247  <a href="../ko/mod/mod_mem_cache.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a></p>
   248  </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
   249  <script type="text/javascript"><!--//--><![CDATA[//><!--
   250  var comments_shortname = 'httpd';
   251  var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mod_mem_cache.html';
   252  (function(w, d) {
   253      if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
   254          d.write('<div id="comments_thread"><\/div>');
   255          var s = d.createElement('script');
   256          s.type = 'text/javascript';
   257          s.async = true;
   258          s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
   259          (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
   260      }
   261      else { 
   262          d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
   263      }
   264  })(window, document);
   265  //--><!]]></script></div><div id="footer">
   266  <p class="apache">Copyright 2017 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
   267  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
   268  if (typeof(prettyPrint) !== 'undefined') {
   269      prettyPrint();
   270  }
   271  //--><!]]></script>
   272  </body></html>