/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//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){ return $_SESSION[MEM_CACHE_SESSION_KEY]; //else echo "Huston we have a problem!"; } public function set($key, $val){ echo "Huston...just to let you know that an override occurs here to $key with val: $val"; $_SESSION[MEM_CACHE_SESSION_KEY][$key] = $val; } }