{"id":39538,"date":"2018-07-18T03:01:42","date_gmt":"2018-07-17T17:01:42","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=39538"},"modified":"2018-07-17T15:46:20","modified_gmt":"2018-07-17T05:46:20","slug":"php-webpage-expiry-and-the-cache-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-webpage-expiry-and-the-cache-primer-tutorial\/","title":{"rendered":"PHP Webpage Expiry and the Cache Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/self_destruct.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP Webpage Expiry and the Cache Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/self_destruct.jpg\" title=\"PHP Webpage Expiry and the Cache Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PHP Webpage Expiry and the Cache Primer Tutorial<\/p><\/div>\n<p>We wanted to talk about the serverside (ie. PHP, for us) topic of Webpage Expiry, for web applications.  You will probably know, if you surf the net, go to a webpage, do some other work, and go back to that original webpage in the same way, you may get identical content even though you know for a fact that that content, should be different and updated.  That can be either a weakness at that website&#8217;s web server code, or be an approach to speeding up response times for the user by using the web browser&#8217;s <a target=_blank title='Cache information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Cache_(computing)'><i>cache<\/i><\/a> to save on revisiting web servers constantly, to get content.<\/p>\n<p>The topic of &#8220;Webpage Expiry&#8221; involves the setting at the web server (for us at www.rjmprogramming.com.au, using PHP) of the webpage&#8217;s expiry date\/time, via the manipulation of the <i>HTTP Expires<\/i> header.  While the Webpage is &#8220;current&#8221; the cache will be called into play, but as soon as the Webpage <i>HTTP Expires<\/i> header is &#8220;clicked over&#8221; timewise, a &#8220;rereading of content from the web server&#8221; (or &#8220;refreshing the cache&#8221;) is triggered.  With today&#8217;s proof of concept <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/self_destruct.php_GETME\" title=\"self_destruct.php\">self_destruct.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/self_destruct.php\" title=\"Click picture\">live run<\/a> we&#8217;d like to thank &#8230;<\/p>\n<ul>\n<li><i>The PHP Anthology (Volume II: Applications)<\/i> by Harry Fuecks\n<p style='display:inline;'> (ISBN: 0-9579218-4-5) for the inspiration and useful code help here<\/p>\n<\/li>\n<li><a target=_blank title='gfycat' href='https:\/\/gfycat.com\/'>gfycat<\/a> for background animated GIF &#8230; thanks &#8230; and &#8230;<\/li>\n<li>colour matching of the background animated GIF via Mac OS X&#8217;s &#8220;Digital Color Meter&#8221; which we talked about at <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/digital-colour-meter-on-mac-laptop-tutorial\/' title='Digital Colour Meter on Mac Laptop Tutorial'>Digital Colour Meter on Mac Laptop Tutorial<\/a><\/li>\n<li>idea of semi-transparent background with less transparent foreground idea we talked about at <a target=_blank title='Rainbow Games Background Image Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/rainbow-games-background-image-mobile-tutorial\/'>Rainbow Games Background Image Tutorial<\/a><\/li>\n<\/ul>\n<p>You can also see this play out at WordPress 4.1.1&#8217;s <a target=_blank title='PHP Webpage Expiry and the Cache Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/php-webpage-expiry-and-the-cache-primer-tutorial\/'>PHP Webpage Expiry and the Cache Primer Tutorial<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d39538' onclick='var dv=document.getElementById(\"d39538\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/cache\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d39538' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We wanted to talk about the serverside (ie. PHP, for us) topic of Webpage Expiry, for web applications. You will probably know, if you surf the net, go to a webpage, do some other work, and go back to that &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-webpage-expiry-and-the-cache-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[177,2616,1996,932,997,1319,1418],"class_list":["post-39538","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-cache","tag-expires-header","tag-header","tag-php","tag-programming","tag-tutorial","tag-webpage"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39538"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=39538"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39538\/revisions"}],"predecessor-version":[{"id":39550,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/39538\/revisions\/39550"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=39538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=39538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=39538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}