Miss Fairy (Beginning)

Well, it is January of 2013, a brand new year, and it is now time to start a new resin figure model. A few months ago while shopping in an arts and crafts store I discovered a proper sized bird cage on clearance for a dollar or two. I realized that this would be a perfect base for a fairy.

I think the idea came to me from seeing Tinker Bell in Disneyland.



Now, a fairy is an interesting figure. I wanted to take silicon molds of the resin parts as I am working towards bronze casting my resin figures. I suspect I will cast this at some time.

Once I have the silicon molds I take wax impressions of the parts. It takes only a few moments to glue them together. This gives me an impression of what this will look like when finished.





W3TC Cache Preload for Version

Back in March 2012 I posted a set of feature enhancements and repairs to cache priming for the WordPress W3TC Total Cache plugin version See my W3TC Cache Preload or Cache Prime posting.

A W3TC security fix was recently released. Unfortunately, the fix introduced a fault with basic mode disk caching. A cached page is now being prefixed with a nine byte ‘<?php /*’ text string. This text is inserted before the page expiry time and compressed page data is written. What this means is that the page expiry time is never picked up successfully when the cache page is referenced. The page is always thought to be expired and cached disk pages are never returned. There is also a problem with decoding of the returned data.


  * Sets data
  * @param string $key
  * @param mixed $var
  * @param integer $expire
  * @return boolean
 function set($key, &$var, $expire = 0) {
    if ($fp) {
      if ($this->_locking) {
         @flock($fp, LOCK_EX);
//    @fputs($fp, '<?php /* ');   // wrong place ...
      @fputs($fp, pack('L', $expire));
      @fputs($fp, '<?php /* ');   // it needs to go here ...
      @fputs($fp, @serialize($var));
  * Returns data
  * @param string $key
  * @return mixed
 function get($key) {
    if ($ftime > time() - $expire) {
      $data = '';
      while (!@feof($fp)) {
        $data .= @fread($fp, 4096);
//    $var = substr($data, 9);   // and this is wrong ...
      $data = substr($data, 9);  // it needs to be this ...
      $var = @unserialize($data);


A corrected version of W3TC that also integrates my previous cache prime feature enhancements can be downloaded here.

Updated Elements

  • w3-total-cache/lib/W3/Config.php
  • w3-total-cache/lib/W3/PgCache.php
  • w3-total-cache/lib/W3/Plugin/PgCacheAdmin.php
  • w3-total-cache/lib/W3/Plugin/TotalCacheAdmin.php
  • w3-total-cache/lib/W3/Plugin/PgCache.php
  • w3-total-cache/lib/W3/Cache/Base.php
  • w3-total-cache/lib/W3/Cache/File.php
  • w3-total-cache/lib/W3/Cache/File/Generic.php
  • w3-total-cache/inc/functions/http.php
  • w3-total-cache/inc/options/pgcache.php


Update, January 6, 2013

Apparently, folks are actually using this feature?  This has prompted me to complete some outstanding items from my cache prime feature enhancement last March, 2012.

  1. The cache prime trace name is now configurable.  The trace resource is publicly accessible from your site URL.  You need a way to turn this on or off.
  2. Cache priming will now generate a new cached page before a previously cached page expires.  Previously, pages were not refreshed until after they had expired.  This change can reduce the probability that an uncached page reference occurs. Pages may now be generated within two update intervals before expected expiry.

The download file referenced above now contains these changes.  The recommended steps to install this feature enhancement on a working W3TC or W3TC implementation are as follows:

  1. Turn off cache priming.  In the Page Cache configuration page clear the checkbox to automatically prime the page cache.  Save all settings.
  2. Empty all cache.
  3. Deactivate the W3TC plugin in WordPress.
  4. Update the plugin code.  Extract the zip file.  Replace the w3-total-cache plugin folder in WordPress with the w3-total-cache folder from the zip file.
  5. Activate the W3TC plugin in WordPress.
  6. Empty all cache again.
  7. Review the Page Cache configuration.  Activate cache priming if desired.


The default TTL (Time to Live) of page cache files is set via the “Expires header lifetime” field in the “HTML” section on Browser Cache Settings tab.  This is 3600 seconds, or one hour.

Specific page expiry times can be set in the Advanced section of the Page Cache configuration. W3TC limits maximum disk cache expiry time to 30 days, or 2592000 seconds.

The example below specifies that any page URL ending with “html” is to be cached for 30 days; any page URL that contain any two digit number between slashes is to be cached for 7 days; and any page URL that begins with “/v/” or “/tag/” or “/category/” is to be cached for 24 hours.  The first identified match in the listed order is used.  If no match is found then the default TTL is set.