caching support in pvalues_by_thresholds