This repository was archived by the owner on Dec 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,15 @@ protected function __construct(array $config)
74
74
$ host = Arr::get ($ server , 'host ' );
75
75
$ port = Arr::get ($ server , 'port ' , NULL );
76
76
$ weight = Arr::get ($ server , 'weight ' , NULL );
77
+ $ status = Arr::get ($ server , 'status ' , TRUE );
77
78
78
79
if (!empty ($ host ))
79
80
{
80
- $ this ->memcached_instance ->addServer ($ host , $ port , $ weight );
81
+ // status can be used by an external healthcheck to mark the memcached instance offline
82
+ if ($ status === TRUE )
83
+ {
84
+ $ this ->memcached_instance ->addServer ($ host , $ port , $ weight );
85
+ }
81
86
}
82
87
else
83
88
{
@@ -108,17 +113,10 @@ public function get($id, $default = NULL)
108
113
{
109
114
$ result = $ this ->memcached_instance ->get ($ id );
110
115
111
- if ($ this ->memcached_instance ->getResultCode () == Memcached::RES_NOTFOUND )
116
+ if ($ this ->memcached_instance ->getResultCode () ! == Memcached::RES_SUCCESS )
112
117
{
113
118
$ result = $ default ;
114
119
}
115
- else
116
- {
117
- Kohana::$ log ->add (Log::INFO , ':method: not found :id ' , array (
118
- ':method ' => __METHOD__ ,
119
- ':id ' => $ id ,
120
- ));
121
- }
122
120
123
121
return $ result ;
124
122
}
You can’t perform that action at this time.
0 commit comments