key( $job_id, $product_id ); $count = (int) get_transient( $key ) + 1; set_transient( $key, $count, self::TTL_SECONDS ); return $count; } /** * Forget this job/product pair's attempt count: a terminal failure (or a * later success) both start the next run clean. * * @param int $job_id * @param int $product_id * @return void */ public function clear( $job_id, $product_id ) { delete_transient( $this->key( $job_id, $product_id ) ); } /** * @param int $job_id * @param int $product_id * @return string */ private function key( $job_id, $product_id ) { return 'aipt_jr_' . (int) $job_id . '_' . (int) $product_id; } }