<?php

class CacheLiteDataSource extends DataSourceDecorator {



	protected $cacheLite;



	public function __construct(IDataSource $dataSource, Cache_Lite $cacheLite) {
		parent::__construct($dataSource);
		$this->cacheLite = $cacheLite;
	}



	public function fetch() {
		if (false !== ($out = $this->cacheLite->get($this->id))) {
			return $out;
		}
		$out = parent::fetch();
		$this->cacheLite->save($out, $this->id);
		return $out;
	}



} // class CacheLiteDataSource

?>