| 139 | |
| 140 | impl MemcachePlugin { |
| 141 | fn hook_memcache_server( |
| 142 | &self, class_name: Option<String>, function_name: String, style: ApiStyle, |
| 143 | ) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) { |
| 144 | ( |
| 145 | Box::new(move |_, execute_data| { |
| 146 | let this = style.get_this_mut(execute_data)?; |
| 147 | let handle = this.handle(); |
| 148 | PEER_MAP.remove(&handle); |
| 149 | |
| 150 | debug!( |
| 151 | handle, |
| 152 | ?class_name, |
| 153 | function_name, |
| 154 | "remove peers cache when server added" |
| 155 | ); |
| 156 | |
| 157 | Ok(Box::new(())) |
| 158 | }), |
| 159 | Noop::noop(), |
| 160 | ) |
| 161 | } |
| 162 | |
| 163 | #[instrument(skip_all)] |
| 164 | fn hook_memcache_empty_methods( |