In computer science, a cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere. If requested data is contained in the cache (cache hit), this request can be served by simply reading the cache, which is comparatively faster. Otherwise (cache miss), the data has to be recomputed or fetched from its original storage location, which is comparatively slower. Hence, the greater the number of requests that can be served from the cache, the faster the overall system performance becomes. Read full article about cache on wikipedia.

This is a simple code on htaccess file to increase cache timeout.


  # YEAR   
     
  Header set Cache-Control "max-age=29030400"   
     
  # WEEK   
     
  Header set Cache-Control "max-age=604800"   
     
  # 45 MIN   
     
  Header set Cache-Control "max-age=2700"   
Here time for use on htaccess

  #  300 5 MIN   
  #  600 10 MIN   
  #  900 15 MIN   
  #  1800 30 MIN   
  #  2700 45 MIN   
  #   
  #  3600 1 HR   
  #  7200 2 HR   
  # 10800 3 HR   
  # 14400 4 HR   
  # 18000 5 HR   
  # 36000 10 HR   
  # 39600 11 HR   
  # 43200 12 HR   
  # 46800 13 HR   
  # 50400 14 HR   
  # 54000 15 HR   
  # 86400 24 HR   
  #   
  # 86400 1 DAY   
  # 172800 2 DAY   
  # 259200 3 DAY   
  # 345600 4 DAY   
  # 432000 5 DAY   
  # 518400 6 DAY   
  # 604800 7 DAY   
  #   
  # 604800 1 WEEK   
  # 1209600 2 WEEK   
  # 1814400 3 WEEK   
  # 2419200 4 WEEK   
  #   
  # 2419200 1 MONTH   
  # 4838400 2 MONTH   
  # 7257600 3 MONTH   
  # 9676800 4 MONTH   
  # 12096000 5 MONTH   
  # 14515200 6 MONTH   
  # 16934400 7 MONTH   
  # 19353600 8 MONTH   
  # 21772800 9 MONTH   
  # 24192000 10 MONTH   
  # 26611200 11 MONTH   
  # 29030400 12 MONTH  
Bored on number? you can use this. Just change to minute, hour, week, month or year.

 <IfModule mod_expires.c>   
    # Enable expiration control   
    ExpiresActive On   
     
    # Default expiration: 1 hour after request   
    ExpiresDefault "now plus 1 hour"   
     
    # CSS and JS expiration: 1 week after request   
    ExpiresByType text/css "now plus 1 week"   
    ExpiresByType application/javascript "now plus 1 week"   
    ExpiresByType application/x-javascript "now plus 1 week"   
     
    # Image files expiration: 1 month after request   
    ExpiresByType image/bmp "now plus 1 month"   
    ExpiresByType image/jp2 "now plus 1 month"   
    ExpiresByType image/pipeg "now plus 1 month"   
    ExpiresByType image/svg+xml "now plus 1 month"   
    ExpiresByType image/tiff "now plus 1 month"   
    ExpiresByType image/vnd.microsoft.icon "now plus 1 month"   
    ExpiresByType image/x-icon "now plus 1 month"   
    ExpiresByType image/ico "now plus 1 month"   
    ExpiresByType image/icon "now plus 1 month"   
    ExpiresByType text/ico "now plus 1 month"   
    ExpiresByType application/ico "now plus 1 month"   
    ExpiresByType image/vnd.wap.wbmp "now plus 1 month"   
    ExpiresByType application/vnd.wap.wbxml "now plus 1 month"   
    ExpiresByType application/smil "now plus 1 month"   
     
    ExpiresByType audio/basic "now plus 1 year"   
    ExpiresByType audio/mid "now plus 1 year"   
    ExpiresByType audio/midi "now plus 1 year"   
    ExpiresByType audio/mpeg "now plus 1 year"   
    ExpiresByType audio/x-aiff "now plus 1 year"   
    ExpiresByType audio/x-mpegurl "now plus 1 year"   
    ExpiresByType audio/x-pn-realaudio "now plus 1 year"   
    ExpiresByType audio/x-wav "now plus 1 year"   
     
    ExpiresByType application/x-shockwave-flash "now plus 1 year"   
    ExpiresByType x-world/x-vrml "now plus 1 year"   
    ExpiresByType video/x-msvideo "now plus 1 year"   
    ExpiresByType video/mpeg "now plus 1 year"   
    ExpiresByType video/mp4 "now plus 1 year"   
    ExpiresByType video/quicktime "now plus 1 year"   
    ExpiresByType video/x-la-asf "now plus 1 year"   
    ExpiresByType video/x-ms-asf "now plus 1 year"   
     
    ExpiresByType image/gif "now plus 1 year"   
    ExpiresByType image/png "now plus 1 year"   
    ExpiresByType image/jpeg "now plus 1 year"   
    ExpiresByType text/plain "now plus 1 year"   
    ExpiresByType application/x-shockwave-flash "now plus 1 year"   
    ExpiresByType video/x-flv "now plus 1 year"   
    ExpiresByType application/pdf "now plus 1 week"   
    ExpiresByType text/html "now plus 1 week"   
  </IfModule>  

This is an example when this code run.

05 Mar 2013

0 comments:

Post a Comment

We are not responsible for comments expressed within this site. It is the account holder's personal views and all risks of comments posted his own account owner's responsibility. Comments wisely as it showed your maturity.

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

Recent Comments

 
Top