Changeset 674 for branches/1.3/xcache.c
- Timestamp:
- 2009-08-26T04:19:36+02:00 (4 years ago)
- Location:
- branches/1.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3
-
branches/1.3/xcache.c
r641 r674 146 146 return memcmp(a->name.ustr.val, b->name.ustr.val, (a->name.ustr.len + 1) * sizeof(UChar)) == 0; 147 147 } 148 else { 149 return memcmp(a->name.str.val, b->name.str.val, a->name.str.len + 1) == 0; 148 #endif 149 if (a->name.str.len != b->name.str.len) { 150 return 0; 150 151 } 151 #else152 152 return memcmp(a->name.str.val, b->name.str.val, a->name.str.len + 1) == 0; 153 #endif 153 154 } while(0); 155 default: 156 assert(0); 157 } 158 return 0; 159 } 160 /* }}} */ 161 static inline int xc_entry_has_prefix_dmz(xc_entry_t *entry, zval *prefix) /* {{{ */ 162 { 163 /* this function isn't required but can be in dmz */ 164 165 switch (entry->type) { 166 case XC_TYPE_PHP: 167 case XC_TYPE_VAR: 168 do { 169 #ifdef IS_UNICODE 170 if (entry->name_type != prefix->type) { 171 return 0; 172 } 173 174 if (entry->name_type == IS_UNICODE) { 175 if (entry->name.ustr.len < Z_USTRLEN_P(prefix)) { 176 return 0; 177 } 178 return memcmp(entry->name.ustr.val, Z_USTRVAL_P(prefix), Z_USTRLEN_P(prefix) * sizeof(UChar)) == 0; 179 } 180 #endif 181 if (prefix->type != IS_STRING) { 182 return 0; 183 } 184 185 if (entry->name.str.len < Z_STRLEN_P(prefix)) { 186 return 0; 187 } 188 189 return memcmp(entry->name.str.val, Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)) == 0; 154 190 155 191 } while(0); … … 2124 2160 } 2125 2161 /* }}} */ 2162 /* {{{ proto bool xcache_unset_by_prefix(string prefix) 2163 Unset existing data in cache by specified prefix */ 2164 PHP_FUNCTION(xcache_unset_by_prefix) 2165 { 2166 zval *prefix; 2167 int i, iend; 2168 2169 if (!xc_var_caches) { 2170 VAR_DISABLED_WARNING(); 2171 RETURN_FALSE; 2172 } 2173 2174 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &prefix) == FAILURE) { 2175 return; 2176 } 2177 2178 for (i = 0, iend = xc_var_hcache.size; i < iend; i ++) { 2179 xc_cache_t *cache = xc_var_caches[i]; 2180 ENTER_LOCK(cache) { 2181 int j, jend; 2182 for (j = 0, jend = cache->hentry->size; j < jend; j ++) { 2183 xc_entry_t *entry, *next; 2184 for (entry = cache->entries[j]; entry; entry = next) { 2185 next = entry->next; 2186 if (xc_entry_has_prefix_dmz(entry, prefix)) { 2187 xc_entry_remove_dmz(entry TSRMLS_CC); 2188 } 2189 } 2190 } 2191 } LEAVE_LOCK(cache); 2192 } 2193 } 2194 /* }}} */ 2126 2195 static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ 2127 2196 { … … 2458 2527 PHP_FE(xcache_isset, NULL) 2459 2528 PHP_FE(xcache_unset, NULL) 2529 PHP_FE(xcache_unset_by_prefix, NULL) 2460 2530 #ifdef HAVE_XCACHE_DPRINT 2461 2531 PHP_FE(xcache_dprint, NULL)
Note: See TracChangeset
for help on using the changeset viewer.

