@@ -21,10 +21,10 @@ public function __construct($config)
2121 public function checkDriver ()
2222 {
2323 if (!class_exists ('Redis ' )) {
24- throw new DriverRequirementFailException (" Redis extension not installed " , self ::NAME );
24+ throw new DriverRequirementFailException (' Redis extension not installed ' , self ::NAME );
2525 }
2626 }
27-
27+
2828 /**
2929 * @return string Driver name
3030 */
@@ -35,6 +35,7 @@ public function getName()
3535
3636 /**
3737 * @param string $key
38+ *
3839 * @return mixed
3940 */
4041 public function get ($ key )
@@ -43,15 +44,17 @@ public function get($key)
4344 $ value = $ this ->client ->get ($ key );
4445
4546 if ($ value == false ) {
46- return null ;
47+ return ;
4748 }
49+
4850 return $ value ;
4951 }
5052
5153 /**
5254 * @param string $key
53- * @param mixed $value
54- * @param integer $ttl
55+ * @param mixed $value
56+ * @param int $ttl
57+ *
5558 * @return mixed
5659 */
5760 public function set ($ key , $ value , $ ttl = null )
@@ -65,11 +68,13 @@ public function set($key, $value, $ttl = null)
6568
6669 /**
6770 * @param string $key
68- * @return boolean
71+ *
72+ * @return bool
6973 */
7074 public function exists ($ key )
7175 {
7276 $ this ->connectServer ();
77+
7378 return $ this ->client ->exists ($ key );
7479 }
7580
@@ -79,31 +84,33 @@ public function exists($key)
7984 public function remove ($ key )
8085 {
8186 $ this ->connectServer ();
87+
8288 return $ this ->client ->delete ($ key );
8389 }
8490
8591 /**
86- * Remove all keys and value from cache
92+ * Remove all keys and value from cache.
8793 */
8894 public function clean ()
8995 {
9096 $ this ->connectServer ();
9197 $ this ->client ->flushDB ();
98+
9299 return true ;
93100 }
94101
95102 private function connectServer ()
96103 {
97104 if (null === $ this ->client ) {
98105 $ host = $ this ->config ['host ' ];
99- $ port = array_key_exists ('port ' , $ this ->config )? (int )$ this ->config ['port ' ]: 6379 ;
100- $ password = (array_key_exists ('password ' , $ this ->config ))? $ this ->config ['password ' ]: '' ;
101- $ database = (array_key_exists ('database ' , $ this ->config )? (int )$ this ->config ['database ' ]: null );
102- $ timeout = (array_key_exists ('timeout ' , $ this ->config ))? (int )$ this ->config ['timeout ' ]: 1 ;
106+ $ port = array_key_exists ('port ' , $ this ->config ) ? (int ) $ this ->config ['port ' ] : 6379 ;
107+ $ password = (array_key_exists ('password ' , $ this ->config )) ? $ this ->config ['password ' ] : '' ;
108+ $ database = (array_key_exists ('database ' , $ this ->config ) ? (int ) $ this ->config ['database ' ] : null );
109+ $ timeout = (array_key_exists ('timeout ' , $ this ->config )) ? (int ) $ this ->config ['timeout ' ] : 1 ;
103110
104111 $ this ->client = new \Redis ();
105112 if (!$ this ->client ->connect ($ host , $ port , $ timeout )) {
106- throw new ServerException (" Error Unable to connect to server " );
113+ throw new ServerException (' Error Unable to connect to server ' );
107114 }
108115
109116 if (null !== $ database ) {
0 commit comments