public function isInCache($ID, $Verbose = false, $UpdateHitsCount = false)
    {
        /* Compute the paths */
        $Index = $this->CacheFolder . "/" . $this->CacheIndex;

        /* Search the picture in the index file */
        $Handle = @fopen($Index, "r");
        while (!feof($Handle)) {
            $IndexPos = ftell($Handle);
            $Entry = fgets($Handle, 4096);
            if ($Entry != "") {
                $Settings = preg_split("/,/", $Entry);
                $PicID = $Settings[0];
                if ($PicID == $ID) {
                    fclose($Handle);

                    $DBPos = $Settings[1];
                    $PicSize = $Settings[2];
                    $GeneratedTS = $Settings[3];
                    $Hits = intval($Settings[4]);

                    if ($UpdateHitsCount) {
                        $Hits++;
                        if (strlen($Hits) < 7) {
                            $Hits = $Hits . str_repeat(" ", 7 - strlen($Hits));
                        }

                        $Handle = @fopen($Index, "r+");
                        fseek($Handle, $IndexPos);
                        fwrite(
                            $Handle,
                            sprintf(
                                "%s,%s,%s,%s,%s\r\n",
                                $PicID,
                                $DBPos,
                                $PicSize,
                                $GeneratedTS,
                                $Hits
                            )
                        );
                        fclose($Handle);
                    }

                    if ($Verbose) {
                        return [
                            "DBPos" => $DBPos,
                            "PicSize" => $PicSize,
                            "GeneratedTS" => $GeneratedTS,
                            "Hits" => $Hits
                        ];
                    } else {
                        return true;
                    }
                }
            }
        }
        fclose($Handle);

        /* Picture isn't in the cache */
        return false;
    }
public function isInCache($ID, $Verbose = false, $UpdateHitsCount = false)
    {
        /* Compute the paths */
        $Index = $this->CacheFolder . "/" . $this->CacheIndex;

        /* Search the picture in the index file */
        $Handle = @fopen($Index, "r");
        while (!feof($Handle)) {
            $IndexPos = ftell($Handle);
            $Entry = fgets($Handle, 4096);
            if ($Entry != "") {
                $Settings = preg_split("/,/", $Entry);
                $PicID = $Settings[0];
                if ($PicID == $ID) {
                    fclose($Handle);

                    $DBPos = $Settings[1];
                    $PicSize = $Settings[2];
                    $GeneratedTS = $Settings[3];
                    $Hits = intval($Settings[4]);

                    if ($UpdateHitsCount) {
                        $Hits++;
                        if (strlen($Hits) < 7) {
                            $Hits = $Hits . str_repeat(" ", 7 - strlen($Hits));
                        }

                        $Handle = @fopen($Index, "r+");
                        fseek($Handle, $IndexPos);
                        fwrite(
                            $Handle,
                            sprintf(
                                "%s,%s,%s,%s,%s\r\n",
                                $PicID,
                                $DBPos,
                                $PicSize,
                                $GeneratedTS,
                                $Hits
                            )
                        );
                        fclose($Handle);
                    }

                    if ($Verbose) {
                        return [
                            "DBPos" => $DBPos,
                            "PicSize" => $PicSize,
                            "GeneratedTS" => $GeneratedTS,
                            "Hits" => $Hits
                        ];
                    } else {
                        return true;
                    }
                }
            }
        }
        fclose($Handle);

        /* Picture isn't in the cache */
        return false;
    }
public function isInCache ( $ ID , $ Verbose = false , $ UpdateHitsCount = false ) { /* Compute the paths */ $ Index = $ this -> CacheFolder . "/" . $ this -> CacheIndex ; /* Search the picture in the index file */ $ Handle = @ fopen ( $ Index , "r" ) ; while ( ! feof ( $ Handle ) ) { $ IndexPos = ftell ( $ Handle ) ; $ Entry = fgets ( $ Handle , 4096 ) ; if ( $ Entry != "" ) { $ Settings = preg_split ( "/,/" , $ Entry ) ; $ PicID = $ Settings [ 0 ] ; if ( $ PicID == $ ID ) { fclose ( $ Handle ) ; $ DBPos = $ Settings [ 1 ] ; $ PicSize = $ Settings [ 2 ] ; $ GeneratedTS = $ Settings [ 3 ] ; $ Hits = intval ( $ Settings [ 4 ] ) ; if ( $ UpdateHitsCount ) { $ Hits ++ ; if ( strlen ( $ Hits ) < 7 ) { $ Hits = $ Hits . str_repeat ( " " , 7 - strlen ( $ Hits ) ) ; } $ Handle = @ fopen ( $ Index , "r+" ) ; fseek ( $ Handle , $ IndexPos ) ; fwrite ( $ Handle , sprintf ( "%s,%s,%s,%s,%s\r\n" , $ PicID , $ DBPos , $ PicSize , $ GeneratedTS , $ Hits ) ) ; fclose ( $ Handle ) ; } if ( $ Verbose ) { return [ "DBPos" => $ DBPos , "PicSize" => $ PicSize , "GeneratedTS" => $ GeneratedTS , "Hits" => $ Hits ] ; } else { return true ; } } } } fclose ( $ Handle ) ; /* Picture isn't in the cache */ return false ; }
Is the file in cache?

@param string $ID
@param boolean $Verbose
@param boolean $UpdateHitsCount
@return boolean
Is the file in cache?