memoization-mini.php 362 B

123456789101112131415
  1. <?php
  2. if (!defined('_ECRIRE_INC_VERSION')) return;
  3. # memoization minimale (preferer le plugin memoization)
  4. function cache_get($key) {
  5. return @unserialize(file_get_contents(_DIR_CACHE."wheels/".$key.".txt"));
  6. }
  7. function cache_set($key, $value) {
  8. $dir = sous_repertoire(_DIR_CACHE,"wheels/");
  9. return ecrire_fichier($dir.$key.".txt", serialize($value));
  10. }
  11. ?>