Drupal 8: Custom Cache Bins

14th September 2019

Drupal's cache system is robust, feature full and extensible. It can be used to cache small blocks of rendered output or the results of more complex calculations. The cache can be stored in a for the page request, in a database or in a different cache system.

Simple PHP Code To Get Last Played Tracks

1st December 2011

The other day I was approached by a friend (Julie Cheung) and asked if I could create some code that would display a list of last played tracks from Julie isn't a PHP developer and so the code I gave her had to be easily understandable so that she could edit it herself if needed. The following code is what I came up with.

Selectively Turn Off Drupal Caching

It is sometimes necessary to turn off caching on certain pages on a Drupal site. This might be when trying to do something out of the ordinary, like write information to a file, or randomly generate a section of a template. The following code can be used to turn off caching just on the front page of the site.

philipnorton42 Fri, 02/19/2010 - 23:38

Google Last Cached Date Finder In PHP

4th September 2009

When Google looks at a page it takes a snapshot of that page and uses this to match against the query a user entered. To view these cached pages run a Google search and look at the Cached link next to the green URL text of the result. When you view the cached page Google will also give you a date that the page was last cached on. This can be used as a metric of your sites importance as the more often the site is cached, the more favourable Google views your page.

Clearing The Filter Cache In Drupal

26th June 2009

Filters are used in Drupal to change the content of the text of a node when it is viewed. The important thing to note is that Drupal filters should never alter the actual content of the node itself. Instead, when a node is saved it stores the output of the filter in the cache_filter table and displays this content the next time the node is viewed. This is useful because it doesn't mess about with the original text, and it speeds up the displaying of the node by running the filters once, rather than every time the node is loaded.

A Simple Introduction To Zend_Cache

The Zend_Cache class is part of the Zend Framework and is used (as its name suggests) to cache things. This can be anything from the front end browser output to the outcome of a complex calculation or even the results of database queries. Zend_Cache is an enormous topic, not just how the class works, but what the best practices are for caching.

philipnorton42 Thu, 04/02/2009 - 11:33
Force Browser To Refresh All Content Using PHP

One issue, especially when creating AJAX applications, is that the browser can cache the contents of the page so that when a similar request is made the same content is presented.

To force the browser to present the content you want it to without caching you can add the following headers to your page.

philipnorton42 Tue, 01/06/2009 - 11:31
Create Images Thumbnails And Cache Them In PHP

Creating image thumbnails is a pretty common practice, and there are a few scripts available that allow you to do this in PHP using the GD2 library. However, they are normally overkill for what should be a simple task, so after a bit of searching and testing I found the following ImageResize class, which is taken from I have modified the code to be PHP5, but if you want the PHP4 version then you can get it from the site.

philipnorton42 Fri, 11/14/2008 - 13:58