Beispiel #1
0
 public static function ClearCache($newSize = 0)
 {
     //save the max cache limit
     $CacheSizeLimit = self::$config["YouTube"]["Cache"]["limit"] - $newSize;
     //while the cache size is greater that the max limit we will remove the oldest video
     while (self::$sql->query("SELECT SUM(size)/{$CacheSizeLimit} as total FROM YouTubeCache")["rows"][0]["total"] >= 1) {
         $oldId = self::$sql->query("SELECT videoID FROM `YouTubeCache` ORDER BY date LIMIT 1")["rows"][0]["videoID"];
         $oldVideo = new YouTube($oldId, false, false);
         $oldVideo->RemoveFromCache();
     }
 }