mod_cache URI¸¦ Å°·Î »ç¿ëÇÏ¿© ³»¿ëÀ» ij½¬ÇÑ´Ù. Experimental mod_cache.c cache_module ÀÌ ¸ðµâÀº ½ÇÇèÀûÀÎ »óÅÂÀÌ´Ù. ¹®¼­´Â ¾ÆÁ÷ ÀÛ¾÷ÁßÀÌ´Ù...

mod_cache´Â °°Àº ÄÄÇ»ÅÍ¿¡ ÀÖ´Â ³»¿ëÀ̳ª ÇÁ·Ï½ÃµÈ ³»¿ëÀ» ij½¬ÇÒ ¼ö ÀÖ´Â RFC 2616 ȣȯ HTTP ³»¿ëij½¬¸¦ ±¸ÇöÇÑ´Ù. mod_cache¸¦ »ç¿ëÇÏ·Á¸é ÀúÀå°ü¸®¸ðµâ(storage management module)ÀÌ ÇÊ¿äÇÏ´Ù. ±âº» ¾ÆÆÄÄ¡ ¹èÆ÷º»¿¡´Â µÎ°¡Áö ÀúÀå°ü¸®¸ðµâÀÌ ÀÖ´Ù:

mod_disk_cache
´Â µð½ºÅ©±â¹Ý ÀúÀå°ü¸®ÀÚ¸¦ ±¸ÇöÇÑ´Ù.
mod_mem_cache
´Â ¸Þ¸ð¸®±â¹Ý ÀúÀå°ü¸®ÀÚ¸¦ ±¸ÇöÇÑ´Ù. mod_mem_cache´Â ÆÄÀϱâ¼úÀÚ¸¦ ij½¬Çϰųª Èü(heap) °ø°£¿¡ °´Ã¼¸¦ ij½¬ÇÏ´Â µÎ°¡Áö ¹æ½ÄÁß ÇÑ°¡Áö ¹æ¹ýÀ¸·Î µ¿ÀÛÇϵµ·Ï ¼³Á¤ÇÒ ¼ö ÀÖ´Ù. mod_mem_cache´Â ÀÚ½ÅÀÌ »ý¼ºÇÑ ³»¿ëÀ» ij½¬Çϰųª, (¿ªÇÁ·Ï½Ã(reverse proxy)·Î ¾Ë·ÁÁø) ProxyPass¸¦ »ç¿ëÇÏ¿© mod_proxy¸¦ À§ÇØ µÞ´Ü ¼­¹ö³»¿ëÀ» ij½¬ÇÒ ¼ö ÀÖ´Ù.

³»¿ëÀ» URI¸¦ Åä´ë·Î ¸¸µç Å°·Î ij½¬¿¡ ÀúÀåÇÏ°í °¡Á®¿Â´Ù. Á¢±Ùº¸È£°¡ µÈ ³»¿ëÀº ij½¬ÇÏÁö¾Ê´Â´Ù.

¼³Á¤¿¹ Sample httpd.conf #
# ¿¹Á¦ ij½¬ ¼³Á¤
#
LoadModule cache_module modules/mod_cache.so

<IfModule mod_cache.c>
#LoadModule disk_cache_module modules/mod_disk_cache.so
<IfModule mod_disk_cache.c>
CacheRoot c:/cacheroot
CacheSize 256
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
</IfModule>

LoadModule mem_cache_module modules/mod_mem_cache.so
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>
</IfModule>
CacheEnable ÁöÁ¤ÇÑ ÀúÀå°ü¸®ÀÚ¸¦ »ç¿ëÇÏ¿© ÁöÁ¤ÇÑ URLÀ» ij½¬ÇÑ´Ù CacheEnable cache_type url-string server configvirtual host

CacheEnable Áö½Ã¾î¸¦ »ç¿ëÇϸé mod_cache°¡ url-string ÀÌÇÏ urlµéÀ» ij½¬ÇÑ´Ù. ij½¬ ÀúÀå°ü¸®ÀÚ´Â cache_type ¾Æ±Ô¸ÕÆ®·Î ÁöÁ¤ÇÑ´Ù. cache_type memÀº mod_mem_cache°¡ ±¸ÇöÇÏ´Â ¸Þ¸ð¸®±â¹Ý ÀúÀå°ü¸®ÀÚ¸¦ »ç¿ëÇÑ´Ù. cache_type disk´Â mod_disk_cache°¡ ±¸ÇöÇÏ´Â µð½ºÅ©±â¹Ý ÀúÀå°ü¸®ÀÚ¸¦ »ç¿ëÇÑ´Ù. cache_type fd´Â mod_mem_cache°¡ ±¸ÇöÇÏ´Â ÆÄÀϱâ¼úÀÚ Ä³½¬¸¦ »ç¿ëÇÑ´Ù.

(¾Æ·¡ ¿¹¿Í °°ÀÌ) URL °ø°£ÀÌ ´Ù¸¥ CacheEnable Áö½Ã¾î¿Í °ãÄ¡¸é ½ÇÁ¦·Î ÇÑ ÀúÀå°ü¸®ÀÚ°¡ ¿äûÀ» ó¸®ÇÒ¶§±îÁö µÎ ÀúÀå°ü¸®ÀÚ¸¦ ¸ðµÎ ½ÇÇàÇÑ´Ù. ¼³Á¤ÆÄÀÏ¿¡¼­ CacheEnable Áö½Ã¾îÀÇ ¼ø¼­´ë·Î ÀúÀå°ü¸®ÀÚ°¡ ½ÇÇàµÈ´Ù.

CacheEnable mem /manual
CacheEnable fd /images
CacheEnable disk /
CacheDisable ƯÁ¤ URLÀ» ij½¬ÇÏÁö ¾Ê´Â´Ù CacheDisable url-string server configvirtual host

CacheDisable Áö½Ã¾î¸¦ »ç¿ëÇϸé mod_cache°¡ url-string ÀÌÇÏÀÇ urlµéÀ» ij½¬ÇÏÁö ¾Ê´Â´Ù.

¿¹Á¦ CacheDisable /local_files
CacheMaxExpire ¹®¼­¸¦ ij½¬ÇÏ´Â ÃÊ´ÜÀ§ ÃÖ´ë½Ã°£ CacheMaxExpire seconds CacheMaxExpire 86400 (ÇÏ·ç) server configvirtual host

CacheMaxExpire Áö½Ã¾î´Â ½ÇÁ¦ ¼­¹ö¸¦ °Ë»çÇÏÁö¾Ê°í ij½¬°¡´ÉÇÑ HTTP ¹®¼­¸¦ À¯ÁöÇÒ ¼ö ÀÖ´Â ÃÊ´ÜÀ§ ÃÖ´ë½Ã°£À» ÁöÁ¤ÇÑ´Ù. Áï, ¹®¼­´Â ÃÖ´ëÇÑ ÀÌ ¼³Á¤°ª¸¸Å­ ¿À·¡µÇ¾ú´Ù. ¹®¼­°¡ ¸¸±â½Ã°£À» ÁöÁ¤ÇÏ¿©µµ ÀÌ ÃÖ´ë°ªÀ» ÁöŲ´Ù.

CacheMaxExpire 604800
CacheDefaultExpire ¸¸±â½Ã°£À» ÁöÁ¤ÇÏÁö¾ÊÀº ¹®¼­¸¦ ij½¬ÇÒ ±âº» ±â°£. CacheDefaultExpire seconds CacheDefaultExpire 3600 (one hour) server configvirtual host

CacheDefaultExpire Áö½Ã¾î´Â ¹®¼­ÀÇ ¸¸±â½Ã°£°ú ÃÖ±Ù¼öÁ¤½Ã°£ÀÌ ¾ø´Â °æ¿ì ¹®¼­¸¦ ij½¬ÇÒ ÃÊ´ÜÀ§ ±âº» ½Ã°£À» ÁöÁ¤ÇÑ´Ù. CacheMaxExpire·Î ÁöÁ¤ÇÑ °ªÀÌ ÀÌ ¼³Á¤À» ¹«½ÃÇÏÁö ¾Ê´Â´Ù.

CacheDefaultExpire 86400
CacheIgnoreNoLastMod ÀÀ´ä¿¡ Last Modified Çì´õ°¡ ¾ø´Ù´Â »ç½ÇÀ» ¹«½ÃÇÑ´Ù. CacheIgnoreNoLastMod On|Off CacheIgnoreNoLastMod Off server configvirtual host

º¸Åë ÃÖ±Ù¼öÁ¤ÀÏÀÌ ¾ø´Â ¹®¼­´Â ij½¬ÇÏÁö ¾Ê´Â´Ù. ¾î¶² °æ¿ì ÃÖ±Ù¼öÁ¤ÀÏÀ» (¿¹¸¦ µé¾î mod_include ó¸®Áß¿¡) »©°Å³ª óÀ½ºÎÅÍ ¾ø¾úÀ» ¼ö°¡ ÀÖ´Ù. CacheIgnoreNoLastMod Áö½Ã¾î´Â ÃÖ±Ù¼öÁ¤ÀÏÀÌ ¾ø´Â ¹®¼­µµ ¹Ýµå½Ã ij½¬Çϵµ·Ï ¸¸µç´Ù. ¹®¼­¿¡ ÃÖ±Ù¼öÁ¤ÀÏ°ú ¸¸±â½Ã°£ÀÌ ¾ø´Â °æ¿ì CacheDefaultExpire Áö½Ã¾î·Î ÁöÁ¤ÇÑ °ªÀ» ¸¸±â½Ã°£À¸·Î »ç¿ëÇÑ´Ù.

CacheIgnoreNoLastMod On
CacheIgnoreCacheControl Ŭ¶óÀ̾ðÆ®°¡ ij½¬ÇÏÁö¾Ê´Â ³»¿ëÀ» ¿äûÇÔÀ» ¹«½ÃÇÑ´Ù. CacheIgnoreCacheControl On|Off CacheIgnoreCacheControl Off server configvirtual host

º¸Åë no-cache³ª no-store Çì´õ°ªÀ» °¡Áø ¹®¼­´Â ij½¬¿¡ ÀúÀåÇÏÁö¾Ê´Â´Ù. CacheIgnoreCacheControl Áö½Ã¾î´Â ÀÌ·± ÇൿÀ» º¯°æÇÑ´Ù. CacheIgnoreCacheControl OnÀ» »ç¿ëÇÏ¸é ¼­¹ö´Â ¹®¼­¿¡ no-cache³ª no-store Çì´õ°ªÀÌ À־ ¹®¼­¸¦ ij½¬ÇÑ´Ù. ÀÎÁõÀÌ ÇÊ¿äÇÑ ¹®¼­´Â Àý´ë·Î ij½¬ÇÏÁö ¾Ê´Â´Ù.

CacheIgnoreCacheControl On
CacheLastModifiedFactor LastModified ½Ã°£À¸·Î ¸¸±â½Ã°£À» °è»êÇϴµ¥ »ç¿ëÇÏ´Â °è¼ö. CacheLastModifiedFactor float CacheLastModifiedFactor 0.1 server configvirtual host

¹®¼­¿¡ ¸¸±â½Ã°£Àº ¾øÁö¸¸ ÃÖ±Ù¼öÁ¤ÀÏÀÌ ÀÖ´Â °æ¿ì ÃÖ±Ù¼öÁ¤ÀÏ ÀÌÈÄ Áö³­ ½Ã°£À¸·Î ¸¸±â½Ã°£À» °è»êÇÑ´Ù. CacheLastModifiedFactor Áö½Ã¾î´Â ¸¸±â½Ã°£À» °è»êÇÏ´Â ´ÙÀ½ °ø½Ä¿¡¼­ »ç¿ëÇÒ factor¸¦ ÁöÁ¤ÇÑ´Ù: expiry-period = time-since-last-modified-date * factor expiry-date = current-date + expiry-period ¿¹¸¦ µé¾î, ¹®¼­°¡ 10 ½Ã°£ Àü¿¡ ¸¶Áö¸·À¸·Î ¼öÁ¤µÇ¾ú°í factor°¡ 0.1À̶ó¸é ¸¸±â±â°£Àº 10*01 = 1 ½Ã°£ÀÌ µÈ´Ù. ÇöÀç ½Ã°£ÀÌ 3:00pmÀ̶ó¸é ¸¸±â½Ã°£Àº 3:00pm + 1½Ã°£ = 4:00pmÀÌ´Ù. ¸¸±â±â°£ÀÌ CacheMaxExpire º¸´Ù ±æ´Ù¸é CacheMaxExpire¸¦ »ç¿ëÇÑ´Ù.

CacheLastModifiedFactor 0.5
CacheIgnoreHeaders ij½¬¿¡ ÁöÁ¤ÇÑ HTTP Çì´õ(µé)¸¦ ÀúÀåÇÏÁö ¾Ê´Â´Ù CacheIgnoreHeaders header-string [header-string] ... CacheIgnoreHeaders None server configvirtual host

RFC 2616¿¡ µû¸£¸é È©°£(hop-by-hop) HTTP Çì´õ´Â ij½¬¿¡ ÀúÀåÇÏÁö ¾Ê´Â´Ù. È©°£ HTTP Çì´õ¿¡´Â ´ÙÀ½°ú °°Àº °ÍÀÌ ÀÖÀ¸¸ç, CacheIgnoreHeaders ¼³Á¤°ú °ü°è¾øÀÌ ¾î¶² °æ¿ì¿¡µµ ij½¬¿¡ ÀúÀåµÇÁö ¾Ê´Â´Ù.

  • Connection
  • Keep-Alive
  • Proxy-Authenticate
  • Proxy-Authorization
  • TE
  • Trailers
  • Transfer-Encoding
  • Upgrade

CacheIgnoreHeaders´Â ij½¬¿¡ ÀúÀåÇÏ¸é ¾ÈµÇ´Â HTTP Çì´õ¸¦ Ãß°¡·Î ÁöÁ¤ÇÑ´Ù. ¿¹¸¦ µé¾î, ÄíÅ°(cookie)¸¦ ij½¬¿¡ ÀúÀåÇÏ¸é ¾ÈµÇ´Â °æ¿ì°¡ ÀÖ´Ù.

CacheIgnoreHeaders´Â ij½¬¿¡ ÀúÀåÇÏÁö ¾ÊÀ» HTTP Çì´õµéÀ» °ø¹éÀ¸·Î ±¸ºÐÇÑ ¸ñ·ÏÀ» ¹Þ´Â´Ù. (RFC 2616¿¡ µû¶ó) ij½¬¿¡ È©°£ Çì´õ¸¸ ÀúÀåÇÏÁö ¾ÊÀ¸·Á¸é, CacheIgnoreHeaders¸¦ NoneÀ¸·Î ¼³Á¤ÇÑ´Ù.

¿¹Á¦ 1 CacheIgnoreHeaders Set-Cookie ¿¹Á¦ 2 CacheIgnoreHeaders None °æ°í: CacheIgnoreHeaders ¼³Á¤À» »ç¿ëÇÏ¿© Expires °°ÀÌ Ä³½¬ °ü¸®¿¡ ÇÊ¿äÇÑ Çì´õ¸¦ ÀúÀåÇÏÁö ¾ÊÀ¸¸é, mod_cache´Â ºñÁ¤»óÀûÀ¸·Î µ¿ÀÛÇÑ´Ù.