获取天气-步骤9-解耦
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取天气-步骤9-解耦相关的知识,希望对你有一定的参考价值。
//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; } }
以上是关于获取天气-步骤9-解耦的主要内容,如果未能解决你的问题,请参考以下文章