On this page
Apache 模块 mod_cache_socache
Description: | 用于 HTTP 缓存过滤器的基于共享对象缓存(socache)的存储模块。 |
---|---|
Status: | Extension |
Module Identifier: | cache_socache_module |
Source File: | mod_cache_socache.c |
Summary
mod_cache_socache为mod_cache实现基于共享对象缓存(socache)的存储 Management 器。
缓存的响应的 Headers 和正文进行组合,并存储在共享库中的单个键下。 实施数量个共享对象缓存可供选择。
可以同时存储多个内容协商的响应,但是此模块尚不支持部分内容的缓存。
# Turn on caching
CacheSocache shmcb
CacheSocacheMaxSize 102400
<Location "/foo">
CacheEnable socache
</Location>
# Fall back to the disk cache
CacheSocache shmcb
CacheSocacheMaxSize 102400
<Location "/foo">
CacheEnable socache
CacheEnable disk
</Location>
Note:
mod_cache_socache需要mod_cache的服务,该服务必须在mod_cache_socache之前加载。
CacheSocache Directive
Description: | 共享对象缓存的实现要使用 |
---|---|
Syntax: | CacheSocache type[:args] |
Context: | 服务器配置,虚拟主机 |
Status: | Extension |
Module: | mod_cache_socache |
Compatibility: | 在 Apache 2.4.5 和更高版本中可用 |
CacheSocache
指令定义要使用的共享库缓存实现的名称,后跟该实现的可选参数。 实施数量个共享对象缓存可供选择。
CacheSocache shmcb
CacheSocacheMaxSize Directive
Description: | 要放入缓存中的条目的最大大小(以字节为单位) |
---|---|
Syntax: | CacheSocacheMaxSize bytes |
Default: | CacheSocacheMaxSize 102400 |
Context: | 服务器配置,虚拟主机,目录,.htaccess |
Status: | Extension |
Module: | mod_cache_socache |
Compatibility: | 在 Apache 2.4.5 和更高版本中可用 |
CacheSocacheMaxSize
指令为要考虑存储在缓存中的文档的 Headers 和正文组合设置最大大小(以字节为单位)。与主体并排存储的标题越大,主体可能越小。
mod_cache_socache模块将仅尝试缓存具有明确内容长度或足够小的内容以在一遍写入的响应。这样做是为了使mod_cache_disk模块有机会缓存比mod_cache_socache中可缓存的响应大的响应。
CacheSocacheMaxSize 102400
CacheSocacheMaxTime Directive
Description: | 将文档放置在缓存中的最长时间(以秒为单位) |
---|---|
Syntax: | CacheSocacheMaxTime seconds |
Default: | CacheSocacheMaxTime 86400 |
Context: | 服务器配置,虚拟主机,目录,.htaccess |
Status: | Extension |
Module: | mod_cache_socache |
Compatibility: | 在 Apache 2.4.5 和更高版本中可用 |
CacheSocacheMaxTime
伪指令以秒为单位设置要保存在缓存中的文档的最大保鲜期(以秒为单位)。此值将覆盖 HTTP 协议为文档定义的新鲜度生存期。
CacheSocacheMaxTime 86400
CacheSocacheMinTime Directive
Description: | 将文档放入缓存的最短时间(以秒为单位) |
---|---|
Syntax: | CacheSocacheMinTime seconds |
Default: | CacheSocacheMinTime 600 |
Context: | 服务器配置,虚拟主机,目录,.htaccess |
Status: | Extension |
Module: | mod_cache_socache |
Compatibility: | 在 Apache 2.4.5 和更高版本中可用 |
CacheSocacheMinTime
伪指令设置应在共享对象缓存中缓存响应的新鲜度之外的响应时间(以秒为单位)。如果仅在响应的整个生命周期内都存储了响应,则将没有机会重新验证响应以使其再次保持新鲜。
CacheSocacheMinTime 600
CacheSocacheReadSize Directive
Description: | 向下游发送数据之前要读取和缓存的文档的最小大小(以字节为单位) |
---|---|
Syntax: | CacheSocacheReadSize bytes |
Default: | CacheSocacheReadSize 0 |
Context: | 服务器配置,虚拟主机,目录,.htaccess |
Status: | Extension |
Module: | mod_cache_socache |
Compatibility: | 在 Apache 2.4.5 和更高版本中可用 |
CacheSocacheReadSize
指令设置在将数据发送到 Client 端之前要从后端读取的最小数据量(以字节为单位)。默认值为零,导致读取的任何大小的所有数据在到达时立即立即向下游传递到 Client 端。将此值设置为较高的值会使磁盘高速缓存在将结果发送到 Client 端之前至少缓冲此数量。从慢速反向代理缓存内容时,这可以提高性能。
该指令仅在将数据保存到缓存中时才生效,而不是从缓存中提供数据。
CacheSocacheReadSize 102400
CacheSocacheReadTime Directive
Description: | 在向下游发送数据之前,读取时应经过的最短时间(以毫秒为单位) |
---|---|
Syntax: | CacheSocacheReadTime milliseconds |
Default: | CacheSocacheReadTime 0 |
Context: | 服务器配置,虚拟主机,目录,.htaccess |
Status: | Extension |
Module: | mod_cache_socache |
Compatibility: | 在 Apache 2.4.5 和更高版本中可用 |
CacheSocacheReadTime
指令设置尝试向下游发送数据到 Client 端之前应该经过的最短时间。在这段时间内,数据将被缓冲,然后再将结果发送给 Client 端。从反向代理缓存内容时,这可以提高性能。
默认值为零将禁用此选项。
该指令仅在将数据保存到缓存中时才生效,而不是从缓存中提供数据。建议将此选项与CacheSocacheReadSize指令一起使用,以确保如果数据到达速度比预期的更快,则服务器不会过多缓冲。
CacheSocacheReadTime 1000