samples/PhotoAlbum/lib/rb.php
public function load($type,$id) {
		if (isset($this->cache[$type][$id])) {
			$this->hits ++;
			$bean = $this->cache[$type][$id];
		}
		else {
			$this->misses ++;
			$bean = parent::load($type,$id);
			if ($bean->id) {
				if (!isset($this->cache[$type])) $this->cache[$type]=array();
				$this->cache[$type][$id] = $bean;
			}
		}
		return $bean;
	}
public function load($type,$id) {
		if (isset($this->cache[$type][$id])) {
			$this->hits ++;
			$bean = $this->cache[$type][$id];
		}
		else {
			$this->misses ++;
			$bean = parent::load($type,$id);
			if ($bean->id) {
				if (!isset($this->cache[$type])) $this->cache[$type]=array();
				$this->cache[$type][$id] = $bean;
			}
		}
		return $bean;
	}
public function load ( $ type , $ id ) { if ( isset ( $ this -> cache [ $ type ] [ $ id ] ) ) { $ this -> hits ++ ; $ bean = $ this -> cache [ $ type ] [ $ id ] ; } else { $ this -> misses ++ ; $ bean = parent :: load ( $ type , $ id ) ; if ( $ bean -> id ) { if ( ! isset ( $ this -> cache [ $ type ] ) ) $ this -> cache [ $ type ] = array ( ) ; $ this -> cache [ $ type ] [ $ id ] = $ bean ; } } return $ bean ; }
Loads a bean by type and id. If the bean cannot be found an
empty bean will be returned instead. This is a cached version
of the loader, if the bean has been cached it will be served
from cache, otherwise the bean will be retrieved from the database
as usual an a new cache entry will be added..

@param string  $type type of bean you are looking for
@param integer $id   identifier of the bean

@return RedBean_OODBBean $bean the bean object found
Loads a bean by type and id . If the bean cannot be found an empty bean will be returned instead . This is a cached version of the loader if the bean has been cached it will be served from cache otherwise the bean will be retrieved from the database as usual an a new cache entry will be added ..