You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							29 lines
						
					
					
						
							665 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							29 lines
						
					
					
						
							665 B
						
					
					
				| <?php | |
| /** | |
|  * redis模型层 | |
|  * @package model | |
|  */ | |
| 
 | |
| class mRedis extends Redis{ | |
|     // 实例 | |
|     protected static $_instance = null; | |
| 
 | |
|     /** | |
|      * Singleton instance(获取自己的实例) | |
|      * | |
|      * @return RedisOperate | |
|      */ | |
|     public static function getInstance($cnf) { | |
|         if (null === self::$_instance) { | |
|             self::$_instance = new self(); | |
| 
 | |
|             $res = self::$_instance->connect($cnf['host'], $cnf['port']); | |
|             self::$_instance->auth('zhicheng123*'); | |
|             if(!$res) { | |
|                 $this->setError('redis_connect'); | |
|                 return false; | |
|             } | |
|         } | |
|         return self::$_instance; | |
|     } | |
| }
 | |
| 
 |