original_string: public function cacheVal($value, $id = null) {
          if ($id == null) {
              if (is_object($value))
                  $id = $this->getIDfromOjb($value);
  
              if ($id == null && $this->getConfig('debug')) {
                  echo "no caching key";
                  return $value;
              }
          }
  
          $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
          $cachetime = $this->getConfig('cacheTime');
  
          if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
              $ser = file_get_contents($cachefile);
              $val = bzdecompress(unserialize($ser));
              return $val;
          } else {
              $ser = bzcompress(serialize($value));
              file_put_contents($cachefile, $ser);
              return $value;
          }
  
          if ($this->getConfig('debug'))
              echo "no caching";
      }
code: public function cacheVal($value, $id = null) {
          if ($id == null) {
              if (is_object($value))
                  $id = $this->getIDfromOjb($value);
  
              if ($id == null && $this->getConfig('debug')) {
                  echo "no caching key";
                  return $value;
              }
          }
  
          $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
          $cachetime = $this->getConfig('cacheTime');
  
          if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
              $ser = file_get_contents($cachefile);
              $val = bzdecompress(unserialize($ser));
              return $val;
          } else {
              $ser = bzcompress(serialize($value));
              file_put_contents($cachefile, $ser);
              return $value;
          }
  
          if ($this->getConfig('debug'))
              echo "no caching";
      }
code_tokens: public function cacheVal ( $ value , $ id = null ) { if ( $ id == null ) { if ( is_object ( $ value ) ) $ id = $ this -> getIDfromOjb ( $ value ) ; if ( $ id == null && $ this -> getConfig ( 'debug' ) ) { echo "no caching key" ; return $ value ; } } $ cachefile = $ this -> getConfig ( 'cacheDir' ) . '/' . utf8_decode ( $ id ) ; $ cachetime = $ this -> getConfig ( 'cacheTime' ) ; if ( file_exists ( $ cachefile ) && time ( ) - $ cachetime < fileatime ( $ cachefile ) ) { $ ser = file_get_contents ( $ cachefile ) ; $ val = bzdecompress ( unserialize ( $ ser ) ) ; return $ val ; } else { $ ser = bzcompress ( serialize ( $ value ) ) ; file_put_contents ( $ cachefile , $ ser ) ; return $ value ; } if ( $ this -> getConfig ( 'debug' ) ) echo "no caching" ; }
docstring: get cached value in time or return value
  @param $value value or object to cache
  @param $id key for cache
  @return object
docstring_tokens: get cached value in time or return value