Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've figured out the issue, which ended up being confusion between what I think a "default" value should be and what CakePHP thinks a "default" value should be.</p> <p>In cake/libs/cache.php, there is a write function which sets the key, value and duration of the cache entry, and passes it to the appropriate engine's write function (in this case APC). In this function it checks the cache config settings from core.php to see if you've specified a duration there. The code from core.php:</p> <pre><code>Cache::config('default', array( 'engine' =&gt; 'Apc', 'duration'=&gt; 9000, 'probability'=&gt; 100, 'prefix' =&gt; Inflector::slug(APP_DIR) . '_', )); </code></pre> <p>You can see that the first argument is the string 'default', which I assume means that the default value for all APC caching should use the following array, which includes a duration of 9000 seconds. However, in the aforementioned write function, it does a check for the instance's __name variable, which in the case of the cache entries, get set to "_cake_core_", instead of the default string value of "default". Shortly after, it goes to the config settings and looks for a value of "_cake_core_". Because this shouldn't be found (as I didn't set it explicitly), or if there was some value set by Cake it would be overridden by my default value (by my definition of default) it would rely on what I've set above. However, this isn't the case at all. In the __loadBoostrap function of cake/libs/configure.php:</p> <pre><code>if (Configure::read() &gt;= 1) { $duration = '+10 seconds'; } else { $duration = '+999 days'; } if (Cache::config('_cake_core_') === false) { Cache::config('_cake_core_', array_merge((array)$cache['settings'], array( 'prefix' =&gt; $prefix . 'cake_core_', 'path' =&gt; $path . DS . 'persistent' . DS, 'serialize' =&gt; true, 'duration' =&gt; $duration ))); } </code></pre> <p>So, if debug is set to 0 (which is what Configure::read() returns when it's not passed anything) and the config string is '_cake_core_' (like it is with my cache entries) it sets $duration to '+999 days', instead of the value I pass. The solution is to create another few lines in core.php like so:</p> <pre><code>Cache::config('_cake_core_', array( 'engine' =&gt; 'Apc', 'duration'=&gt; 9000, 'probability'=&gt; 100, 'prefix' =&gt; Inflector::slug(APP_DIR) . '_', )); </code></pre> <p>which overrides Cake's "default" or hard-coded value of 10 seconds or 999 days, depending on the debug value.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload