Changeset 858 for trunk/xcache.c
- Timestamp:
- 2012-03-28T15:01:47+02:00 (14 months ago)
- File:
-
- 1 edited
-
trunk/xcache.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r857 r858 338 338 xc_entry_php_t *xce_php = (xc_entry_php_t *) xce; 339 339 fresh = p_php->file_mtime == xce_php->file_mtime && p_php->php->file_size == xce_php->php->file_size; 340 break;341 340 } 341 break; 342 342 343 343 case XC_TYPE_VAR: 344 fresh = 1; 344 { 345 fresh = !VAR_ENTRY_EXPIRED(p); 346 } 345 347 break; 346 348 … … 2688 2690 xc_entry_var_t xce, *stored_xce; 2689 2691 zval *name; 2690 int found = 0;2691 2692 2692 2693 if (!xc_var_caches) { … … 2702 2703 2703 2704 ENTER_LOCK(cache) { 2704 stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash. cacheslotid, (xc_entry_t *) &xce TSRMLS_CC);2705 stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC); 2705 2706 if (stored_xce) { 2706 if (!VAR_ENTRY_EXPIRED(&stored_xce->entry)) { 2707 found = 1; 2708 xc_processor_restore_zval(return_value, stored_xce->value, stored_xce->have_references TSRMLS_CC); 2709 /* return */ 2710 break; 2711 } 2712 else { 2713 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.cacheslotid, (xc_entry_t *) stored_xce TSRMLS_CC); 2714 } 2715 } 2716 2717 RETVAL_NULL(); 2707 /* return */ 2708 xc_processor_restore_zval(return_value, stored_xce->value, stored_xce->have_references TSRMLS_CC); 2709 xc_cache_hit_dmz(cache TSRMLS_CC); 2710 } 2711 else { 2712 RETVAL_NULL(); 2713 cache->misses ++; 2714 } 2718 2715 } LEAVE_LOCK(cache); 2719 if (found) {2720 xc_cache_hit_dmz(cache TSRMLS_CC);2721 }2722 else {2723 cache->misses ++;2724 }2725 2716 } 2726 2717 /* }}} */ … … 2771 2762 xc_entry_var_t xce, *stored_xce; 2772 2763 zval *name; 2773 int found = 0;2774 2764 2775 2765 if (!xc_var_caches) { … … 2787 2777 stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC); 2788 2778 if (stored_xce) { 2789 if (!VAR_ENTRY_EXPIRED(&stored_xce->entry)) { 2790 found = 1; 2791 RETVAL_TRUE; 2792 /* return */ 2793 break; 2794 } 2795 else { 2796 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_xce TSRMLS_CC); 2797 } 2798 } 2799 2800 RETVAL_FALSE; 2779 xc_cache_hit_dmz(cache TSRMLS_CC); 2780 RETVAL_TRUE; 2781 /* return */ 2782 } 2783 else { 2784 RETVAL_FALSE; 2785 } 2786 2801 2787 } LEAVE_LOCK(cache); 2802 if (found) {2803 xc_cache_hit_dmz(cache TSRMLS_CC);2804 }2805 else {2806 cache->misses ++;2807 }2808 2788 } 2809 2789 /* }}} */ … … 2902 2882 2903 2883 ENTER_LOCK(cache) { 2904 stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash. cacheslotid, (xc_entry_t *) &xce TSRMLS_CC);2884 stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC); 2905 2885 if (stored_xce) { 2906 2886 TRACE("incdec: gotxce %s", xce.entry.name.str.val); 2907 /* timeout */ 2908 if (VAR_ENTRY_EXPIRED(&(stored_xce->entry))) { 2909 TRACE("%s", "incdec: expired"); 2910 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.cacheslotid, (xc_entry_t *) stored_xce TSRMLS_CC); 2911 stored_xce = NULL; 2912 } 2913 else { 2914 /* do it in place */ 2915 if (Z_TYPE_P(stored_xce->value) == IS_LONG) { 2916 zval *zv; 2917 stored_xce->entry.ctime = XG(request_time); 2918 stored_xce->entry.ttl = xce.entry.ttl; 2919 TRACE("%s", "incdec: islong"); 2920 value = Z_LVAL_P(stored_xce->value); 2921 value += (inc == 1 ? count : - count); 2922 RETVAL_LONG(value); 2923 2924 zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_xce->value); 2925 Z_LVAL_P(zv) = value; 2926 break; /* leave lock */ 2927 } 2928 else { 2929 TRACE("%s", "incdec: notlong"); 2930 xc_processor_restore_zval(&oldzval, stored_xce->value, stored_xce->have_references TSRMLS_CC); 2931 convert_to_long(&oldzval); 2932 value = Z_LVAL(oldzval); 2933 zval_dtor(&oldzval); 2934 } 2935 } 2887 /* do it in place */ 2888 if (Z_TYPE_P(stored_xce->value) == IS_LONG) { 2889 zval *zv; 2890 stored_xce->entry.ctime = XG(request_time); 2891 stored_xce->entry.ttl = xce.entry.ttl; 2892 TRACE("%s", "incdec: islong"); 2893 value = Z_LVAL_P(stored_xce->value); 2894 value += (inc == 1 ? count : - count); 2895 RETVAL_LONG(value); 2896 2897 zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_xce->value); 2898 Z_LVAL_P(zv) = value; 2899 break; /* leave lock */ 2900 } 2901 2902 TRACE("%s", "incdec: notlong"); 2903 xc_processor_restore_zval(&oldzval, stored_xce->value, stored_xce->have_references TSRMLS_CC); 2904 convert_to_long(&oldzval); 2905 value = Z_LVAL(oldzval); 2906 zval_dtor(&oldzval); 2936 2907 } 2937 2908 else { … … 2941 2912 value += (inc == 1 ? count : - count); 2942 2913 RETVAL_LONG(value); 2943 stored_xce->value = return_value;2914 xce.value = return_value; 2944 2915 2945 2916 if (stored_xce) {
Note: See TracChangeset
for help on using the changeset viewer.

