summaryrefslogtreecommitdiff
path: root/poc/poc02-compiling-cake/src
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-08-03 17:14:41 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-08-03 17:14:41 +0000
commit7c4143798b972dc5bbf566e023e47e575a548409 (patch)
tree87888ae79145674a520a89c1730551b51b4101cb /poc/poc02-compiling-cake/src
parent4c0cb2204e0924131aad564b99ef56d64659f1cd (diff)
download2012-php-weave-7c4143798b972dc5bbf566e023e47e575a548409.tar.gz
2012-php-weave-7c4143798b972dc5bbf566e023e47e575a548409.tar.bz2
2012-php-weave-7c4143798b972dc5bbf566e023e47e575a548409.zip
Ajout de la gestion du cache: on ne reparse pas un fichier déjà en cache s'il n'a pas été modifié
git-svn-id: file:///var/svn/2012-php-weave/trunk@13 d972a294-176a-4cf9-8ea1-fcd5b0c30f5c
Diffstat (limited to 'poc/poc02-compiling-cake/src')
-rw-r--r--poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php b/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
index 5e4f7de..198b113 100644
--- a/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
+++ b/poc/poc02-compiling-cake/src/php-weave/cakephp_weaver.class.php
@@ -32,8 +32,12 @@ class CakePHPWeaver extends AbstractWeaver {
$env=$fw_props; //TODO : More things here ?
foreach ($filelist as $f) {
- //TODO : cache match
$cache_filepath=$cache_path . "/" . sha1($f) . "-" . substr(sha1(print_r($env,true)),-8,8) . ".ast";
+ // If the cache is already up to date, skip parsing
+ if ( $stat_cache=stat($cache_filepath) ) {
+ $stat_source=stat($f);
+ if ($stat_cache['mtime'] >= $stat_source['mtime'] ) continue;
+ }
$ast=$this->parseAndWalk($f, null, $env);
$this->serializeAST($ast, $f, $cache_filepath);