/**
  * @param string $location The file system path to the directory that should
  * be used to store the cache files. The local system's temp directory is
  * used by default.
  * @return SagFileCache
  */
 public function __construct($location)
 {
     if (!is_dir($location)) {
         throw new SagException("The provided cache location is not a directory.");
     }
     if (!is_readable($location) || !is_writable($location)) {
         throw new SagException("Insufficient privileges to the supplied cache directory.");
     }
     parent::__construct();
     $this->fsLocation = rtrim($location, "/ \t\n\r\v");
     /* 
      * Just update - don't freak out if the size isn't right, as the user might
      * update it to non-default, they might not do anything with the cache,
      * they might clean it themselves, etc. give them time. We'll freak when we
      * add.
      */
     foreach (glob($this->fsLocation . "/*" . self::$fileExt) as $file) {
         self::addToSize(filesize($file));
     }
 }
Beispiel #2
0
 public function __construct()
 {
     parent::__construct();
     $this->cache = array();
 }