Tag Archive for cache

Cache Control with htaccess EXPIRES BY TYPE

# Cache Control with .htaccess EXPIRES BY TYPE
# from <a href="http://forum.powweb.com/showthread.php?t=62786" >http://forum.powweb.com/showthread.php?t=62786</a>

### turn on the Expires engine
ExpiresActive On

### expires after a month in the client's cache
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType application/pdf A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/plain A2592000

### expires after 4.8 hours
ExpiresByType text/css A17200

# Please note that the "A" before the numbers above stands for Access.
# This means that the stopwatch starts when a client accesses the file.
# You can also use "M" for modified.

# TIME CHEAT SHEET
#      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 (FEBRUARY)
#  2505600   1 MONTH (FEBRUARY LEAP YEAR)
#  2592000   1 MONTH (APRIL, JUNE, SEPTEMBER, NOVEMBER)
#  2678400   1 MONTH (JANUARY, MARCH, MAY, JULY, AUGUST, OCTOBER, DECEMBER)
# 31536000  12 MONTH

source

Cache Control with htaccess FILES MATCH

# Cache Control with .htaccess
# from <a href="http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html" >http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html</a>

# 3 Month
<FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=7257600"
</FilesMatch>

# 1 Week
<FilesMatch ".(js|css|pdf|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>

# 10 Minutes
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=600"
</FilesMatch>

# NONE
<FilesMatch ".(pl|php|cgi|spl)$">
Header unset Cache-Control
Header unset Expires
Header unset Last-Modified
FileETag None
Header unset Pragma
</FilesMatch>

# TIME CHEAT SHEET
#      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 (FEBRUARY)
#  2505600   1 MONTH (FEBRUARY LEAP YEAR)
#  2592000   1 MONTH (APRIL, JUNE, SEPTEMBER, NOVEMBER)
#  2678400   1 MONTH (JANUARY, MARCH, MAY, JULY, AUGUST, OCTOBER, DECEMBER)
# 31536000  12 MONTH

source

Code Cache Prevention Code

<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="expires" content="FRI, 13 APR 1999 01:00:00 GMT">

source

How to Flush Your DNS Cache on Apple Mac OS X

lookupd -flushcache

source

CSS Image Preloader

#preloadedImages {
width: 0px;
height: 0px;
display: inline;
background-image: url(path/to/image1.png);
background-image: url(path/to/image2.png);
background-image: url(path/to/image3.png);
background-image: url(path/to/image4.png);
background-image: url();
}

source

ASP no cache

<%
pStr = "private, no-cache, must-revalidate no-store pre-check=0 post-check=0 max-stale=0"
Response.ExpiresAbsolute = #2000-01-01#
response.AddHeader "Pragma", "no-cache"
response.AddHeader "cache-control", pStr
%>

source

OS X Icon Cache Cleaner-Upper

find $HOME/Library/Safari/Icons -type f -atime +30 -name "*.cache" -delete

source