You are here

function pCache::getFromCache in Visitors 7

Same name and namespace in other branches
  1. 8 pchart/pCache.inc \pCache::GetFromCache()
  2. 7.2 pChart/class/pCache.class.php \pCache::getFromCache()
  3. 7.0 pchart/pCache.inc \pCache::GetFromCache()
2 calls to pCache::getFromCache()
pCache::saveFromCache in pChart/class/pCache.class.php
pCache::strokeFromCache in pChart/class/pCache.class.php

File

pChart/class/pCache.class.php, line 255

Class

pCache

Code

function getFromCache($ID) {

  /* Compute the path */
  $Database = $this->CacheFolder . "/" . $this->CacheDB;

  /* Lookup for the picture in the cache */
  $CacheInfo = $this
    ->isInCache($ID, TRUE, TRUE);

  /* Not in the cache */
  if (!$CacheInfo) {
    return NULL;
  }

  /* Get the database extended information */
  $DBPos = $CacheInfo["DBPos"];
  $PicSize = $CacheInfo["PicSize"];

  /* Extract the picture from the solid cache file */
  $Handle = @fopen($Database, "r");
  fseek($Handle, $DBPos);
  $Picture = fread($Handle, $PicSize);
  fclose($Handle);

  /* Return back the raw picture data */
  return $Picture;
}