Function __global->set_cache_entry

Definitions

sources/caches2.php

  • Put a result into the cache.This will use persistent cache if enabled, else the database.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$codename MINIID_TEXT No No required parameter N/A N/A The codename to check for caching
$ttl integer No No required parameter N/A N/A The TTL of what is being cached in minutes; this is set directly on the TTL flag for the cache engine
$cache_identifier LONG_TEXT No No required parameter N/A N/A The requisite situational information (a serialized map) [-> further restraints when reading]
$cache mixed No No required parameter N/A N/A The result we are caching; do not use null or a boolean
$special_cache_flags integer No No 24 N/A N/A Special cache flags
$_langs_required array No No [] N/A N/A A list of the language files that need loading to use Tempcode embedded in the cache
$_javascripts_required array No No [] N/A N/A A list of the javascript files that need loading to use Tempcode embedded in the cache
$_csss_required array No No [] N/A N/A A list of the css files that need loading to use Tempcode embedded in the cache
$tempcode boolean No No False N/A N/A Whether we are caching Tempcode (needs special care)
$staff_status ?BINARY No No Null N/A N/A Staff status to limit to (null: Get from environment)
$member_id ?MEMBER No No Null N/A N/A Member to limit to (null: Get from environment)
$groups ?SHORT_TEXT No No Null N/A N/A Sorted permissive usergroup list to limit to (null: Get from environment)
$is_bot ?BINARY No No Null N/A N/A Bot status to limit to (null: Get from environment)
$timezone ?MINIID_TEXT No No Null N/A N/A Timezone to limit to (null: Get from environment)
$theme ?ID_TEXT No No Null N/A N/A The theme this is being cached for (null: Get from environment)
$lang ?LANGUAGE_NAME No No Null N/A N/A The language this is being cached for (null: Get from environment)

Preview

Code (PHP)

/**
 * Put a result into the cache.This will use persistent cache if enabled, else the database.
 *
 * @param  MINIID_TEXT $codename The codename to check for caching
 * @param  integer $ttl The TTL of what is being cached in minutes; this is set directly on the TTL flag for the cache engine
 * @param  LONG_TEXT $cache_identifier The requisite situational information (a serialized map) [-> further restraints when reading]
 * @param  mixed $cache The result we are caching; do not use null or a boolean
 * @param  integer $special_cache_flags Special cache flags
 * @param  array $_langs_required A list of the language files that need loading to use Tempcode embedded in the cache
 * @param  array $_javascripts_required A list of the javascript files that need loading to use Tempcode embedded in the cache
 * @param  array $_csss_required A list of the css files that need loading to use Tempcode embedded in the cache
 * @param  boolean $tempcode Whether we are caching Tempcode (needs special care)
 * @param  ?BINARY $staff_status Staff status to limit to (null: Get from environment)
 * @param  ?MEMBER $member_id Member to limit to (null: Get from environment)
 * @param  ?SHORT_TEXT $groups Sorted permissive usergroup list to limit to (null: Get from environment)
 * @param  ?BINARY $is_bot Bot status to limit to (null: Get from environment)
 * @param  ?MINIID_TEXT $timezone Timezone to limit to (null: Get from environment)
 * @param  ?ID_TEXT $theme The theme this is being cached for (null: Get from environment)
 * @param  ?LANGUAGE_NAME $lang The language this is being cached for (null: Get from environment)
 */

function set_cache_entry(string $codename, int $ttl, string $cache_identifier, $cache, int $special_cache_flags = 24, array $_langs_required = [], array $_javascripts_required = [], array $_csss_required = [], bool $tempcode = false, ?int $staff_status = null, ?int $member_id = null, ?string $groups = null, ?int $is_bot = null, ?string $timezone = null, ?string $theme = null, ?string $lang = null)