2
2
3
3
namespace ByJG \Cache \Psr16 ;
4
4
5
+ use ByJG \Cache \Exception \StorageErrorException ;
5
6
use Memcached ;
6
7
use Psr \Log \NullLogger ;
7
8
@@ -38,7 +39,7 @@ protected function fixKey($key) {
38
39
}
39
40
40
41
/**
41
- * @throws \Exception
42
+ * @throws StorageErrorException
42
43
*/
43
44
protected function lazyLoadMemCachedServers ()
44
45
{
@@ -50,7 +51,7 @@ protected function lazyLoadMemCachedServers()
50
51
51
52
$ stats = $ this ->memCached ->getStats ();
52
53
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 " );
54
55
}
55
56
}
56
57
}
@@ -60,7 +61,7 @@ protected function lazyLoadMemCachedServers()
60
61
* @param string $key The object KEY
61
62
* @param int $default IGNORED IN MEMCACHED.
62
63
* @return mixed Description
63
- * @throws \Exception
64
+ * @throws StorageErrorException
64
65
*/
65
66
public function get ($ key , $ default = null )
66
67
{
@@ -80,7 +81,7 @@ public function get($key, $default = null)
80
81
* @param object $value The object to be cached
81
82
* @param int $ttl The time to live in seconds of this objects
82
83
* @return bool If the object is successfully posted
83
- * @throws \Exception
84
+ * @throws StorageErrorException
84
85
*/
85
86
public function set ($ key , $ value , $ ttl = null )
86
87
{
@@ -98,7 +99,7 @@ public function set($key, $value, $ttl = null)
98
99
/**
99
100
* @param string $key
100
101
* @return bool
101
- * @throws \Exception
102
+ * @throws StorageErrorException
102
103
*/
103
104
public function delete ($ key )
104
105
{
@@ -117,14 +118,14 @@ public function isAvailable()
117
118
try {
118
119
$ this ->lazyLoadMemCachedServers ();
119
120
return true ;
120
- } catch (\ Exception $ ex ) {
121
+ } catch (StorageErrorException $ ex ) {
121
122
return false ;
122
123
}
123
124
}
124
125
125
126
/**
126
127
* @return bool
127
- * @throws \Exception
128
+ * @throws StorageErrorException
128
129
*/
129
130
public function clear ()
130
131
{
@@ -136,7 +137,7 @@ public function clear()
136
137
/**
137
138
* @param string $key
138
139
* @return bool
139
- * @throws \Exception
140
+ * @throws StorageErrorException
140
141
*/
141
142
public function has ($ key )
142
143
{
0 commit comments