\CacheableNavigation_Rebuild
This BuildTask pre-primes the filesystem or in-memory caches for {@link SiteTree} and {@link SiteConfig} native SilverStripe objects.
The BuildTask should be run from the command-line as the webserver user
e.g. www-data otherwise while attempting to access the site from a browser, the
webserver won't have permission to access the cache. E.g:
<code>
#> sudo -u www-data ./framework/sake dev/tasks/CacheableNavigation_Rebuild
<code>
You may pass-in an optional "Stage" parameter, with a value of one of "Live"
or "Stage" which helps when debugging or breaking-up the job to make it more
manageable in terms of system resources. It will restrict the cache-rebuild
to objects in the given stage. The default is to cache objects
in both "Stage" and "Live" modes which takes longer to run and uses more memory.
- Author: Deviate Ltd 2014-2015 http://www.deviate.net.nz
Synopsis
class CacheableNavigation_Rebuild
extends BuildTask
{
- // members
- public static number $chunk_divisor = 20;
- protected string $description = 'Rebuilds silverstripe-cacheable object cache.';
- // methods
- public void run()
- public boolean chunkForQueue()
- private string percentageComplete()
- private number memory()
- public static string new_line()
- public number queue()
- public void showConfig()
Hierarchy
Extends
- BuildTask
Tasks
Line | Task |
---|---|
27+ | Rename task to better suit the module's new name |
27+ | Cache filled using {@link Zend_Cache_Core::getFillingPercentage()}. |
Members
protected
- $description — string
public
- $chunk_divisor
—
number
A suitable number by which to break-up the total number of pages.
Methods
private
- memory() — Utility method: Current memory usage in Mb.
- percentageComplete() — Utility method: Generate a percentage of how complete the cache rebuild is, including optional memory usage.
public
- chunkForQueue() — Returning boolean true|false this method dictates what gets queued and when.
- new_line() — Utility method: Generate an O/S independent new-line, for as many times as is required.
- queue() — Create a {@link ChunkedCachableRefreshJob} for each "chunk" of N pages to refresh the caches of. Once run, $chunk is truncated and passed back its original reference.
- run() — Physically runs the task which - dependent on QueuedJobs being installed and not skipped via script params - will queue-up chunks of pages to be cached, or just attempt to cache call objects at once.
- showConfig() — Summarise the task's configuration details at the end of a run.