/** * Get latest reports. * * @access public * * @return array $reports An array of reports with their data. */ public static function reports() { // Delete cache if report was changed if (did_action('save_post_' . Reports::POST_TYPE)) { Cache::delete(__METHOD__); } // If cached, return cache if (false !== ($items = Cache::get(__METHOD__))) { return $items; } // Get reports from database $items = Reports::reports(); // Save reports to cache Cache::set(__METHOD__, $items); return $items; }