File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -163,12 +163,21 @@ protected function driverConnect()
163163 }
164164
165165 if (!empty ($ server [ 'sasl_user ' ]) && !empty ($ server [ 'sasl_password ' ])) {
166- $ this -> instance -> setSaslAuthData ( $ server [ ' sasl_user ' ], $ server [ ' sasl_password ' ] );
166+ throw new phpFastCacheDriverException ( ' Unlike Memcached, Memcache does not support SASL authentication ' );
167167 }
168168 } catch (\Exception $ e ) {
169169 $ this ->fallback = true ;
170170 }
171171 }
172+
173+ /**
174+ * Since Memcached does not throw
175+ * any error if not connected ...
176+ */
177+ if (!$ this ->instance ->getServerStatus ()){
178+ throw new phpFastCacheDriverException ('Memcache seems to not be connected ' );
179+ }
180+ return true ;
172181 }
173182
174183 /********************
Original file line number Diff line number Diff line change @@ -159,10 +159,21 @@ protected function driverConnect()
159159 if (!empty ($ server [ 'sasl_user ' ]) && !empty ($ server [ 'sasl_password ' ])) {
160160 $ this ->instance ->setSaslAuthData ($ server [ 'sasl_user ' ], $ server [ 'sasl_password ' ]);
161161 }
162+
162163 } catch (\Exception $ e ) {
163164 $ this ->fallback = true ;
164165 }
165166 }
167+
168+ /**
169+ * Since Memcached does not throw
170+ * any error if not connected ...
171+ */
172+ $ version = $ this ->instance ->getVersion ();
173+ if (!$ version || $ this ->instance ->getResultCode () !== MemcachedSoftware::RES_SUCCESS ){
174+ throw new phpFastCacheDriverException ('Memcached seems to not be connected ' );
175+ }
176+ return true ;
166177 }
167178
168179 /********************
You can’t perform that action at this time.
0 commit comments