| 
					
				 | 
			
			
				@@ -4,25 +4,44 @@ namespace Queue\Src; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Dever; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-class Queue 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+class Queue implements QueueInterface 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	private $method; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private $db; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private $key; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public function __construct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$method = 'Queue\\Src\\' . ucfirst(Dever::config('base')->queue['method']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$this->method = new $method(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$db = 'Queue\\Src\\' . ucfirst(Dever::config('base')->queue['method']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->db = new $db(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public function push($value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private function key($key = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (!$key) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			$key = DEVER_PROJECT . '_' . DEVER_APP_NAME; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $key; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function push($value, $key = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		$value = json_encode($value, JSON_UNESCAPED_UNICODE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$this->method->push($value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$this->db->push($this->key($key), $value); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	public function pop() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function pop($key = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		$data = $this->method->pop(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$data = $this->db->pop($this->key($key)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return json_decode($data, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function len($key = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $this->db->len($this->key($key)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public function get() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return $this->db; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |