예제 #1
0
 /**
  * @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));
     }
 }
예제 #2
0
파일: SagMemoryCache.php 프로젝트: hyla/sag
 public function __construct()
 {
     parent::__construct();
     $this->cache = array();
 }