/** * Fetch people count from database * * @since 1.0 * * @param string $type * * @return int */ function erp_get_peoples_count($type = 'contact') { $cache_key = 'erp-people-count-' . $type; $count = wp_cache_get($cache_key, 'wp-erp'); if (false === $count) { $count = WeDevs\ERP\Framework\Models\People::type($type)->count(); wp_cache_set($cache_key, $count, 'wp-erp'); } return intval($count); }