MCPcopy Create free account
hub / github.com/apache/skywalking-php / hook

Method hook

src/plugin/plugin_memcache.rs:91–137  ·  view source on GitHub ↗
(
        &self, class_name: Option<&str>, function_name: &str,
    )

Source from the content-addressed store, hash-verified

89 }
90
91 fn hook(
92 &self, class_name: Option<&str>, function_name: &str,
93 ) -> Option<(
94 Box<crate::execute::BeforeExecuteHook>,
95 Box<crate::execute::AfterExecuteHook>,
96 )> {
97 let lowercase_function_name = function_name.to_ascii_lowercase();
98 let function_name = function_name.to_owned();
99
100 match (class_name, &*lowercase_function_name) {
101 (Some("Memcache" | "MemcachePool"), "connect" | "addserver" | "close") => {
102 Some(self.hook_memcache_server(
103 class_name.map(ToOwned::to_owned),
104 function_name,
105 ApiStyle::OO,
106 ))
107 }
108 (None, "memcache_add_server" | "memcache_close") => {
109 Some(self.hook_memcache_server(None, function_name, ApiStyle::Procedural))
110 }
111 (Some("Memcache" | "MemcachePool"), f)
112 if MEMCACHE_EMPTY_METHOD_MAPPING.contains_key(f) =>
113 {
114 Some(self.hook_memcache_empty_methods(
115 class_name.map(ToOwned::to_owned),
116 function_name,
117 ApiStyle::OO,
118 ))
119 }
120 (None, f) if MEMCACHE_EMPTY_METHOD_MAPPING.contains_key(&f["memcache_".len()..]) => {
121 Some(self.hook_memcache_empty_methods(None, function_name, ApiStyle::Procedural))
122 }
123 (Some("Memcache" | "MemcachePool"), f)
124 if MEMCACHE_KEY_METHOD_MAPPING.contains_key(f) =>
125 {
126 Some(self.hook_memcache_key_methods(
127 class_name.map(ToOwned::to_owned),
128 function_name,
129 ApiStyle::OO,
130 ))
131 }
132 (None, f) if MEMCACHE_KEY_METHOD_MAPPING.contains_key(&f["memcache_".len()..]) => {
133 Some(self.hook_memcache_key_methods(None, function_name, ApiStyle::Procedural))
134 }
135 _ => None,
136 }
137 }
138}
139
140impl MemcachePlugin {

Callers

nothing calls this directly

Calls 3

hook_memcache_serverMethod · 0.80

Tested by

no test coverage detected