Changeset 673 for trunk/xcache.c
- Timestamp:
- 2009-08-26T04:18:14+02:00 (4 years ago)
- File:
-
- 1 edited
-
trunk/xcache.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r672 r673 210 210 return memcmp(a->name.ustr.val, b->name.ustr.val, (a->name.ustr.len + 1) * sizeof(UChar)) == 0; 211 211 } 212 else { 213 return memcmp(a->name.str.val, b->name.str.val, a->name.str.len + 1) == 0; 212 #endif 213 if (a->name.str.len != b->name.str.len) { 214 return 0; 214 215 } 215 #else216 216 return memcmp(a->name.str.val, b->name.str.val, a->name.str.len + 1) == 0; 217 #endif 217 218 } while(0); 219 default: 220 assert(0); 221 } 222 return 0; 223 } 224 /* }}} */ 225 static inline int xc_entry_has_prefix_dmz(xc_entry_t *entry, zval *prefix) /* {{{ */ 226 { 227 /* this function isn't required but can be in dmz */ 228 229 switch (entry->type) { 230 case XC_TYPE_PHP: 231 case XC_TYPE_VAR: 232 do { 233 #ifdef IS_UNICODE 234 if (entry->name_type != prefix->type) { 235 return 0; 236 } 237 238 if (entry->name_type == IS_UNICODE) { 239 if (entry->name.ustr.len < Z_USTRLEN_P(prefix)) { 240 return 0; 241 } 242 return memcmp(entry->name.ustr.val, Z_USTRVAL_P(prefix), Z_USTRLEN_P(prefix) * sizeof(UChar)) == 0; 243 } 244 #endif 245 if (prefix->type != IS_STRING) { 246 return 0; 247 } 248 249 if (entry->name.str.len < Z_STRLEN_P(prefix)) { 250 return 0; 251 } 252 253 return memcmp(entry->name.str.val, Z_STRVAL_P(prefix), Z_STRLEN_P(prefix)) == 0; 218 254 219 255 } while(0); … … 2656 2692 } 2657 2693 /* }}} */ 2694 /* {{{ proto bool xcache_unset_by_prefix(string prefix) 2695 Unset existing data in cache by specified prefix */ 2696 PHP_FUNCTION(xcache_unset_by_prefix) 2697 { 2698 zval *prefix; 2699 int i, iend; 2700 2701 if (!xc_var_caches) { 2702 VAR_DISABLED_WARNING(); 2703 RETURN_FALSE; 2704 } 2705 2706 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &prefix) == FAILURE) { 2707 return; 2708 } 2709 2710 for (i = 0, iend = xc_var_hcache.size; i < iend; i ++) { 2711 xc_cache_t *cache = xc_var_caches[i]; 2712 ENTER_LOCK(cache) { 2713 int j, jend; 2714 for (j = 0, jend = cache->hentry->size; j < jend; j ++) { 2715 xc_entry_t *entry, *next; 2716 for (entry = cache->entries[j]; entry; entry = next) { 2717 next = entry->next; 2718 if (xc_entry_has_prefix_dmz(entry, prefix)) { 2719 xc_entry_remove_dmz(entry TSRMLS_CC); 2720 } 2721 } 2722 } 2723 } LEAVE_LOCK(cache); 2724 } 2725 } 2726 /* }}} */ 2658 2727 static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ 2659 2728 { … … 2990 3059 PHP_FE(xcache_isset, NULL) 2991 3060 PHP_FE(xcache_unset, NULL) 3061 PHP_FE(xcache_unset_by_prefix, NULL) 2992 3062 #ifdef HAVE_XCACHE_DPRINT 2993 3063 PHP_FE(xcache_dprint, NULL)
Note: See TracChangeset
for help on using the changeset viewer.

