<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mod_cache_socache.xml.meta">

<name>mod_cache_socache</name>
<description>Shared object cache (socache) based storage module for the
HTTP caching filter.</description>
<status>Extension</status>
<sourcefile>mod_cache_socache.c</sourcefile>
<identifier>cache_socache_module</identifier>

<summary>
    <p><module>mod_cache_socache</module> implements a shared object cache
    (socache) based storage manager for <module>mod_cache</module>.</p>

    <p>The headers and bodies of cached responses are combined, and stored
    underneath a single key in the shared object cache. A
    <a href="../socache.html">number of implementations</a> of shared object
    caches are available to choose from.</p>

    <p>Multiple content negotiated responses can be stored concurrently,
    however the caching of partial content is not yet supported by this
    module.</p>

    <highlight language="config">
# Turn on caching
CacheSocache shmcb
CacheSocacheMaxSize 102400
&lt;Location /foo&gt;
    CacheEnable socache
&lt;/Location&gt;

# Fall back to the disk cache
CacheSocache shmcb
CacheSocacheMaxSize 102400
&lt;Location /foo&gt;
    CacheEnable socache
    CacheEnable disk
&lt;/Location&gt;
    </highlight>

    <note><title>Note:</title>
      <p><module>mod_cache_socache</module> requires the services of
      <module>mod_cache</module>, which must be loaded before
      mod_cache_socache.</p>
    </note>
</summary>
<seealso><module>mod_cache</module></seealso>
<seealso><module>mod_cache_disk</module></seealso>
<seealso><a href="../caching.html">Caching Guide</a></seealso>

<directivesynopsis>
<name>CacheSocache</name>
<description>The shared object cache implementation to use</description>
<syntax>CacheSocache <var>type[:args]</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
<compatibility>Available in Apache 2.4.5 and later</compatibility>

<usage>
    <p>The <directive>CacheSocache</directive> directive defines the name of
    the shared object cache implementation to use, followed by optional
    arguments for that implementation. A <a href="../socache.html">number of
    implementations</a> of shared object caches are available to choose
    from.</p>

    <highlight language="config">
      CacheSocache shmcb
    </highlight>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheSocacheMaxTime</name>
<description>The maximum time (in seconds) for a document to be placed in the
cache</description>
<syntax>CacheSocacheMaxTime <var>seconds</var></syntax>
<default>CacheSocacheMaxTime 86400</default>
<contextlist><context>server config</context>
  <context>virtual host</context>
  <context>directory</context>
  <context>.htaccess</context>
</contextlist>
<compatibility>Available in Apache 2.4.5 and later</compatibility>

<usage>
    <p>The <directive>CacheSocacheMaxTime</directive> directive sets the
    maximum freshness lifetime, in seconds, for a document to be stored in
    the cache. This value overrides the freshness lifetime defined for the
    document by the HTTP protocol.</p>

    <highlight language="config">
      CacheSocacheMaxTime 86400
    </highlight>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheSocacheMinTime</name>
<description>The minimum time (in seconds) for a document to be placed in the
cache</description>
<syntax>CacheSocacheMinTime <var>seconds</var></syntax>
<default>CacheSocacheMinTime 600</default>
<contextlist><context>server config</context>
  <context>virtual host</context>
  <context>directory</context>
  <context>.htaccess</context>
</contextlist>
<compatibility>Available in Apache 2.4.5 and later</compatibility>

<usage>
    <p>The <directive>CacheSocacheMinTime</directive> directive sets the
    amount of seconds beyond the freshness lifetime of the response that the
    response should be cached for in the shared object cache. If a response is
    only stored for its freshness lifetime, there will be no opportunity to
    revalidate the response to make it fresh again.</p>

    <highlight language="config">
      CacheSocacheMinTime 600
    </highlight>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheSocacheMaxSize</name>
<description>The maximum size (in bytes) of an entry to be placed in the
cache</description>
<syntax>CacheSocacheMaxSize <var>bytes</var></syntax>
<default>CacheSocacheMaxSize 102400</default>
<contextlist><context>server config</context>
  <context>virtual host</context>
  <context>directory</context>
  <context>.htaccess</context>
</contextlist>
<compatibility>Available in Apache 2.4.5 and later</compatibility>

<usage>
    <p>The <directive>CacheSocacheMaxSize</directive> directive sets the
    maximum size, in bytes, for the combined headers and body of a document
    to be considered for storage in the cache. The larger the headers that
    are stored alongside the body, the smaller the body may be.</p>

    <p>The <module>mod_cache_socache</module> module will only attempt to
    cache responses that have an explicit content length, or that are small
    enough to be written in one pass. This is done to allow the
    <module>mod_cache_disk</module> module to have an opportunity to cache
    responses larger than those cacheable within
    <module>mod_cache_socache</module>.</p>

    <highlight language="config">
      CacheSocacheMaxSize 102400
    </highlight>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheSocacheReadSize</name>
<description>The minimum size (in bytes) of the document to read and be cached
  before sending the data downstream</description>
<syntax>CacheSocacheReadSize <var>bytes</var></syntax>
<default>CacheSocacheReadSize 0</default>
<contextlist><context>server config</context>
    <context>virtual host</context>
    <context>directory</context>
    <context>.htaccess</context>
</contextlist>
<compatibility>Available in Apache 2.4.5 and later</compatibility>

<usage>
    <p>The <directive>CacheSocacheReadSize</directive> directive sets the
    minimum amount of data, in bytes, to be read from the backend before the
    data is sent to the client. The default of zero causes all data read of
    any size to be passed downstream to the client immediately as it arrives.
    Setting this to a higher value causes the disk cache to buffer at least
    this amount before sending the result to the client. This can improve
    performance when caching content from a slow reverse proxy.</p>

    <p>This directive only takes effect when the data is being saved to the
    cache, as opposed to data being served from the cache.</p>

    <highlight language="config">
      CacheReadSize 102400
    </highlight>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>CacheSocacheReadTime</name>
<description>The minimum time (in milliseconds) that should elapse while reading
  before data is sent downstream</description>
<syntax>CacheSocacheReadTime <var>milliseconds</var></syntax>
<default>CacheSocacheReadTime 0</default>
<contextlist><context>server config</context>
  <context>virtual host</context>
  <context>directory</context>
  <context>.htaccess</context>
</contextlist>
<compatibility>Available in Apache 2.4.5 and later</compatibility>

<usage>
    <p>The <directive>CacheSocacheReadTime</directive> directive sets the minimum amount
    of elapsed time that should pass before making an attempt to send data
    downstream to the client. During the time period, data will be buffered
    before sending the result to the client. This can improve performance when
    caching content from a reverse proxy.</p>

    <p>The default of zero disables this option.</p>

    <p>This directive only takes effect when the data is being saved to the
    cache, as opposed to data being served from the cache. It is recommended
    that this option be used alongside the
    <directive module="mod_cache_socache">CacheSocacheReadSize</directive> directive
    to ensure that the server does not buffer excessively should data arrive faster
    than expected.</p>

    <highlight language="config">
      CacheSocacheReadTime 1000
    </highlight>
</usage>
</directivesynopsis>

</modulesynopsis>
