function set($key,$val,$ttl=0) {
		$fw=Base::instance();
		if (!$this->dsn)
			return TRUE;
		$ndx=$this->prefix.'.'.$key;
		if ($cached=$this->exists($key))
			$ttl=$cached[1];
		$data=$fw->serialize([$val,microtime(TRUE),$ttl]);
		$parts=explode('=',$this->dsn,2);
		switch ($parts[0]) {
			case 'apc':
			case 'apcu':
				return call_user_func($parts[0].'_store',$ndx,$data,$ttl);
			case 'redis':
				return $this->ref->set($ndx,$data,$ttl?['ex'=>$ttl]:[]);
			case 'memcache':
				return memcache_set($this->ref,$ndx,$data,0,$ttl);
			case 'memcached':
				return $this->ref->set($ndx,$data,$ttl);
			case 'wincache':
				return wincache_ucache_set($ndx,$data,$ttl);
			case 'xcache':
				return xcache_set($ndx,$data,$ttl);
			case 'folder':
				return $fw->write($parts[1].
					str_replace(['/','\\'],'',$ndx),$data);
		}
		return FALSE;
	}
function set($key,$val,$ttl=0) {
		$fw=Base::instance();
		if (!$this->dsn)
			return TRUE;
		$ndx=$this->prefix.'.'.$key;
		if ($cached=$this->exists($key))
			$ttl=$cached[1];
		$data=$fw->serialize([$val,microtime(TRUE),$ttl]);
		$parts=explode('=',$this->dsn,2);
		switch ($parts[0]) {
			case 'apc':
			case 'apcu':
				return call_user_func($parts[0].'_store',$ndx,$data,$ttl);
			case 'redis':
				return $this->ref->set($ndx,$data,$ttl?['ex'=>$ttl]:[]);
			case 'memcache':
				return memcache_set($this->ref,$ndx,$data,0,$ttl);
			case 'memcached':
				return $this->ref->set($ndx,$data,$ttl);
			case 'wincache':
				return wincache_ucache_set($ndx,$data,$ttl);
			case 'xcache':
				return xcache_set($ndx,$data,$ttl);
			case 'folder':
				return $fw->write($parts[1].
					str_replace(['/','\\'],'',$ndx),$data);
		}
		return FALSE;
	}
function set ( $ key , $ val , $ ttl = 0 ) { $ fw = Base :: instance ( ) ; if ( ! $ this -> dsn ) return TRUE ; $ ndx = $ this -> prefix . '.' . $ key ; if ( $ cached = $ this -> exists ( $ key ) ) $ ttl = $ cached [ 1 ] ; $ data = $ fw -> serialize ( [ $ val , microtime ( TRUE ) , $ ttl ] ) ; $ parts = explode ( '=' , $ this -> dsn , 2 ) ; switch ( $ parts [ 0 ] ) { case 'apc' : case 'apcu' : return call_user_func ( $ parts [ 0 ] . '_store' , $ ndx , $ data , $ ttl ) ; case 'redis' : return $ this -> ref -> set ( $ ndx , $ data , $ ttl ? [ 'ex' => $ ttl ] : [ ] ) ; case 'memcache' : return memcache_set ( $ this -> ref , $ ndx , $ data , 0 , $ ttl ) ; case 'memcached' : return $ this -> ref -> set ( $ ndx , $ data , $ ttl ) ; case 'wincache' : return wincache_ucache_set ( $ ndx , $ data , $ ttl ) ; case 'xcache' : return xcache_set ( $ ndx , $ data , $ ttl ) ; case 'folder' : return $ fw -> write ( $ parts [ 1 ] . str_replace ( [ '/' , '\\' ] , '' , $ ndx ) , $ data ) ; } return FALSE ; }
Store value in cache
@return mixed|FALSE
@param $key string
@param $val mixed
@param $ttl int
Store value in cache