Return to Snippet

Revision: 28105
at June 30, 2010 22:33 by orenus


Initial Code
//decoupling: 
//changing the inner impl of MemCache without affecting the 
//consumers...they get what they need without KNOWING or CARING about 
//the inner implementation of MemCache...

class MemCache extends BaseCache{
	
	//define("MEM_CACHE_SESSION_KEY", "__memcachesessionkey");	
	
	public function MemCache(){
		//some intitialization here...
	}
	
	public function get($key){
		if (!array_key_exists($key, $_SESSION[MEM_CACHE_SESSION_KEY]))
			return $_SESSION[MEM_CACHE_SESSION_KEY];
		
		//else
		echo "Huston we have a problem!";
	}
	
	public function set($key, $val){
		if (array_key_exists($key, $_SESSION[MEM_CACHE_SESSION_KEY]))
			echo "Huston...just to let you know that an override occurs here to $key with val: $val";
		
		$_SESSION[MEM_CACHE_SESSION_KEY][$key] = $val;
	}
}

Initial URL

                                

Initial Description

                                

Initial Title
Get Weather - Step 9 - Decoupling

Initial Tags
php

Initial Language
PHP