22
33namespace ByJG \Cache \Psr16 ;
44
5+ use ByJG \Cache \Exception \StorageErrorException ;
56use Memcached ;
67use Psr \Log \NullLogger ;
78
@@ -38,7 +39,7 @@ protected function fixKey($key) {
3839 }
3940
4041 /**
41- * @throws \Exception
42+ * @throws StorageErrorException
4243 */
4344 protected function lazyLoadMemCachedServers ()
4445 {
@@ -50,7 +51,7 @@ protected function lazyLoadMemCachedServers()
5051
5152 $ stats = $ this ->memCached ->getStats ();
5253 if (!isset ($ stats [$ server ]) || $ stats [$ server ]['pid ' ] === -1 ) {
53- throw new \ Exception ("Memcached server $ server is down " );
54+ throw new StorageErrorException ("Memcached server $ server is down " );
5455 }
5556 }
5657 }
@@ -60,7 +61,7 @@ protected function lazyLoadMemCachedServers()
6061 * @param string $key The object KEY
6162 * @param int $default IGNORED IN MEMCACHED.
6263 * @return mixed Description
63- * @throws \Exception
64+ * @throws StorageErrorException
6465 */
6566 public function get ($ key , $ default = null )
6667 {
@@ -80,7 +81,7 @@ public function get($key, $default = null)
8081 * @param object $value The object to be cached
8182 * @param int $ttl The time to live in seconds of this objects
8283 * @return bool If the object is successfully posted
83- * @throws \Exception
84+ * @throws StorageErrorException
8485 */
8586 public function set ($ key , $ value , $ ttl = null )
8687 {
@@ -98,7 +99,7 @@ public function set($key, $value, $ttl = null)
9899 /**
99100 * @param string $key
100101 * @return bool
101- * @throws \Exception
102+ * @throws StorageErrorException
102103 */
103104 public function delete ($ key )
104105 {
@@ -117,14 +118,14 @@ public function isAvailable()
117118 try {
118119 $ this ->lazyLoadMemCachedServers ();
119120 return true ;
120- } catch (\ Exception $ ex ) {
121+ } catch (StorageErrorException $ ex ) {
121122 return false ;
122123 }
123124 }
124125
125126 /**
126127 * @return bool
127- * @throws \Exception
128+ * @throws StorageErrorException
128129 */
129130 public function clear ()
130131 {
@@ -136,7 +137,7 @@ public function clear()
136137 /**
137138 * @param string $key
138139 * @return bool
139- * @throws \Exception
140+ * @throws StorageErrorException
140141 */
141142 public function has ($ key )
142143 {
0 commit comments