Function __global->cache_and_carry

Definitions

sources/http.php

  • Call a function, with inbuilt on-disk caching support.TODO: Go through cache_and_carry args and apply $post_breaks_cache where necessary.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$func mixed No No required parameter N/A N/A Function to call
$args array No No required parameter N/A N/A Arguments to call with
$timeout ?integer No No Null N/A N/A Caching timeout in minutes (null: no timeout)
$cache_errors boolean No No False N/A N/A Whether to cache HTTP statuses that do not start '2'
$post_breaks_cache boolean No No True N/A N/A Whether the 'post_params' argument of HTTP requests should break the cache if changed

Returns

  • The function result OR for cms_http_request calls a tuple of result details
  • Type: mixed
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Call a function, with inbuilt on-disk caching support.TODO: Go through cache_and_carry args and apply $post_breaks_cache where necessary.
 *
 * @param  mixed $func Function to call
 * @param  array $args Arguments to call with
 * @param  ?integer $timeout Caching timeout in minutes (null: no timeout)
 * @param  boolean $cache_errors Whether to cache HTTP statuses that do not start '2'
 * @param  boolean $post_breaks_cache Whether the 'post_params' argument of HTTP requests should break the cache if changed
 * @return mixed The function result OR for cms_http_request calls a tuple of result details
 */

function cache_and_carry($func, array $args, ?int $timeout = null, bool $cache_errors = false, bool $post_breaks_cache = true)