Changeset 032a12a in git
- Timestamp:
- 2012-07-14T04:44:18Z (7 years ago)
- Branches:
- 3.0, 3.1, 3.2, master, trunk
- Children:
- fb9bb38
- Parents:
- 5aa5f6e
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
rf8d40fb r032a12a 1 1 2.1.0 2012-??-?? 2 * fixes #972: warning/error when XCache is loaded incorrectly 3 * fixes #73: warn for improper PHP_FCGI_CHILDREN setting fcgi mode 2 API Changes 3 ======== 4 * chg: proto array xcache_clear_cache(int type, [ int id = -1 ]). -1 means all cache splits 5 ChangeLog 6 ======== 7 * closes #972: warning/error when XCache is loaded incorrectly 8 * closes #73: warn for improper PHP_FCGI_CHILDREN setting fcgi mode 9 * closes #174: updated api for clear all cache 4 10 5 11 2.0.1 2012-07-14 -
admin/xcache.php
r64b072f r032a12a 239 239 if (isset($_POST['clearcache'])) { 240 240 $count = xcache_count($type); 241 if ($cacheid == $count) {241 if ($cacheid >= 0) { 242 242 for ($cacheid = 0; $cacheid < $count; $cacheid ++) { 243 243 xcache_clear_cache($type, $cacheid); … … 245 245 } 246 246 else { 247 xcache_clear_cache($type , $cacheid);247 xcache_clear_cache($type); 248 248 } 249 249 } … … 272 272 $total['type'] = XC_TYPE_PHP; 273 273 $total['cache_name'] = _T('Total'); 274 $total['cacheid'] = $pcnt;274 $total['cacheid'] = -1; 275 275 $total['gc'] = null; 276 276 $total['istotal'] = true; … … 296 296 $total['type'] = XC_TYPE_VAR; 297 297 $total['cache_name'] = _T('Total'); 298 $total['cacheid'] = $vcnt;298 $total['cacheid'] = -1; 299 299 $total['gc'] = null; 300 300 $total['istotal'] = true; -
xcache.c
r5aa5f6e r032a12a 2683 2683 } 2684 2684 /* }}} */ 2685 static void xc_clear(long type, xc_cache_t *cache TSRMLS_DC) /* {{{ */ 2686 { 2687 xc_entry_t *e, *next; 2688 int entryslotid, c; 2689 2690 ENTER_LOCK(cache) { 2691 for (entryslotid = 0, c = cache->hentry->size; entryslotid < c; entryslotid ++) { 2692 for (e = cache->entries[entryslotid]; e; e = next) { 2693 next = e->next; 2694 xc_entry_remove_unlocked(type, cache, entryslotid, e TSRMLS_CC); 2695 } 2696 cache->entries[entryslotid] = NULL; 2697 } 2698 } LEAVE_LOCK(cache); 2699 } /* }}} */ 2685 2700 /* {{{ xcache_admin_operate */ 2686 2701 typedef enum { XC_OP_COUNT, XC_OP_INFO, XC_OP_LIST, XC_OP_CLEAR } xcache_op_type; … … 2698 2713 } 2699 2714 2700 if (optype == XC_OP_COUNT) { 2701 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { 2702 return; 2703 } 2704 } 2705 else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &type, &id) == FAILURE) { 2706 return; 2715 switch (optype) { 2716 case XC_OP_COUNT: 2717 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &type) == FAILURE) { 2718 return; 2719 } 2720 break; 2721 case XC_OP_CLEAR: 2722 id = -1; 2723 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &type, &id) == FAILURE) { 2724 return; 2725 } 2726 break; 2727 default: 2728 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &type, &id) == FAILURE) { 2729 return; 2730 } 2707 2731 } 2708 2732 … … 2747 2771 } LEAVE_LOCK(cache); 2748 2772 break; 2773 2749 2774 case XC_OP_CLEAR: 2750 { 2751 xc_entry_t *e, *next; 2752 int entryslotid, c; 2753 2754 if (!caches || id < 0 || id >= size) { 2755 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cache not exists"); 2756 RETURN_FALSE; 2775 if (!caches || id < -1 || id >= size) { 2776 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cache not exists"); 2777 RETURN_FALSE; 2778 } 2779 2780 if (id == -1) { 2781 for (id = 0; id < size; ++id) { 2782 xc_clear(type, caches[id] TSRMLS_CC); 2757 2783 } 2758 2759 cache = caches[id]; 2760 ENTER_LOCK(cache) { 2761 for (entryslotid = 0, c = cache->hentry->size; entryslotid < c; entryslotid ++) { 2762 for (e = cache->entries[entryslotid]; e; e = next) { 2763 next = e->next; 2764 xc_entry_remove_unlocked(type, cache, entryslotid, e TSRMLS_CC); 2765 } 2766 cache->entries[entryslotid] = NULL; 2767 } 2768 } LEAVE_LOCK(cache); 2769 xc_gc_deletes(TSRMLS_C); 2770 } 2784 } 2785 else { 2786 xc_clear(type, caches[id] TSRMLS_CC); 2787 } 2788 2789 xc_gc_deletes(TSRMLS_C); 2771 2790 break; 2772 2791 … … 2797 2816 } 2798 2817 /* }}} */ 2799 /* {{{ proto array xcache_clear_cache(int type, int id)2818 /* {{{ proto array xcache_clear_cache(int type, [ int id = -1 ]) 2800 2819 Clear cache by id on specified cache type */ 2801 2820 PHP_FUNCTION(xcache_clear_cache)
Note: See TracChangeset
for help on using the changeset viewer.