HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Caches and Comcode pages

» Return to Contents



sources/caches.php

Global_functions_caches.php

Function summary

void init__caches ()
?mixed persistant_cache_get (mixed key, ?TIME min_cache_date)
void persistant_cache_set (mixed key, mixed data, boolean server_wide, ?integer expire_secs)
void persistant_cache_delete (mixed key)
void persistant_cache_empty ()
void decache (ID_TEXT cached_for, ?array identifier)
?array find_cache_on (ID_TEXT codename)
?mixed get_cache_entry (ID_TEXT codename, LONG_TEXT cache_identifier, integer ttl, boolean tempcode, boolean caching_via_cron, ?array map)
void request_via_cron (ID_TEXT codename, ?array map, boolean tempcode)

void init__caches()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

?mixed persistant_cache_get(mixed key, ?TIME min_cache_date)

Get data from the persistant cache.

Parameters…

Name key
Description Key
Type mixed

Name min_cache_date
Description Minimum timestamp that entries from the cache may hold (NULL: don't care)
Default value
Type ?TIME

Returns…

Description The data (NULL: not found / NULL entry)
Type ?mixed

Return to the function index for this class Expand: View the source code to this function

void persistant_cache_set(mixed key, mixed data, boolean server_wide, ?integer expire_secs)

Put data into the persistant cache.

Parameters…

Name key
Description Key
Type mixed

Name data
Description The data
Type mixed

Name server_wide
Description Whether it is server-wide data
Default value boolean-false
Type boolean

Name expire_secs
Description The expiration time in seconds. (NULL: Default expiry in 60 minutes, or never if it is server-wide).
Default value
Type ?integer

(No return value)


Return to the function index for this class Expand: View the source code to this function

void persistant_cache_delete(mixed key)

Delete data from the persistant cache.

Parameters…

Name key
Description Key name
Type mixed

(No return value)


Return to the function index for this class Expand: View the source code to this function

void persistant_cache_empty()

Remove all data from the persistant cache.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void decache(ID_TEXT cached_for, ?array identifier)

Remove an item from the general cache (most commonly used for blocks).

Parameters…

Name cached_for
Description The type of what we are cacheing (e.g. block name)
Type ID_TEXT

Name identifier
Description A map of identifiying characteristics (NULL: no identifying characteristics, decache all)
Default value
Type ?array

(No return value)


Return to the function index for this class Expand: View the source code to this function

?array find_cache_on(ID_TEXT codename)

Find the cache-on parameters for 'codename's cacheing style (prevents us needing to load up extra code to find it).

Parameters…

Name codename
Description The codename of what will be checked for cacheing
Type ID_TEXT

Returns…

Description The cached result (NULL: no cached result)
Type ?array

Return to the function index for this class Expand: View the source code to this function

?mixed get_cache_entry(ID_TEXT codename, LONG_TEXT cache_identifier, integer ttl, boolean tempcode, boolean caching_via_cron, ?array map)

Find the cached result of what is named by codename and the further constraints.

Parameters…

Name codename
Description The codename to check for cacheing
Type ID_TEXT

Name cache_identifier
Description The further restraints (a serialized map)
Type LONG_TEXT

Name ttl
Description The TTL for the cache entry
Default value 10000
Type integer

Name tempcode
Description Whether we are cacheing Tempcode (needs special care)
Default value boolean-false
Type boolean

Name caching_via_cron
Description Whether to defer caching to CRON. Note that this option only works if the block's defined cache signature depends only on $map (timezone, bot-type, in-panel and interlock are automatically considered)
Default value boolean-false
Type boolean

Name map
Description Parameters to call up block with if we have to defer caching (NULL: none)
Default value
Type ?array

Returns…

Description The cached result (NULL: no cached result)
Type ?mixed

Return to the function index for this class Expand: View the source code to this function

void request_via_cron(ID_TEXT codename, ?array map, boolean tempcode)

Request that CRON loads up a block's caching in the background.

Parameters…

Name codename
Description The codename of the block
Type ID_TEXT

Name map
Description Parameters to call up block with if we have to defer caching (NULL: none)
Type ?array

Name tempcode
Description Whether we are cacheing Tempcode (needs special care)
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

sources/view_modes.php

Global_functions_view_modes.php

Function summary

void init__view_modes ()
void initialise_special_page_types (ID_TEXT special_page_type)
void special_page_types (ID_TEXT special_page_type, tempcode out, string out_evaluated)
?PATH find_template_path (ID_TEXT name)
string find_template_tree_nice (ID_TEXT codename, array children, boolean fresh, boolean cache_started)
tempcode ocportal_cleanup (?array caches)
void erase_tempcode_cache ()
void erase_comcode_cache ()
void erase_cached_language ()
void erase_cached_templates (boolean preserve_some)
string do_xhtml_validation (string out, boolean display_regardless, integer preview_mode, boolean ret)
string display_validation_results (string out, array error, boolean preview_mode, boolean ret)

void init__view_modes()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void initialise_special_page_types(ID_TEXT special_page_type)

Initialise state variables for the special page type being requested.

Parameters…

Name special_page_type
Description The special page type.
Type ID_TEXT
Values restricted to query templates tree lang

(No return value)


Return to the function index for this class Expand: View the source code to this function

void special_page_types(ID_TEXT special_page_type, tempcode out, string out_evaluated)

Handle special page type output.

Parameters…

Name special_page_type
Description The special page type.
Type ID_TEXT
Values restricted to query templates tree lang

Name out
Description The normal script tempcode output
Type tempcode

Name out_evaluated
Description The normal script evaluated output
Type string

(No return value)


Return to the function index for this class Expand: View the source code to this function

?PATH find_template_path(ID_TEXT name)

Finds the path of the given template codename.

Parameters…

Name name
Description The template codename
Type ID_TEXT

Returns…

Description A path (NULL: no such template)
Type ?PATH

Return to the function index for this class Expand: View the source code to this function

string find_template_tree_nice(ID_TEXT codename, array children, boolean fresh, boolean cache_started)

Convert a template tree structure into a HTML representation.

Parameters…

Name codename
Description The codename of the current template item in the recursion
Type ID_TEXT

Name children
Description The template tree structure for children
Type array

Name fresh
Description Whether the template tree came from a cache (if so, we can take some liberties with it's presentation)
Type boolean

Name cache_started
Description As $fresh, except something underneath at any unknown point did come from the cache, so this must have by extension
Default value boolean-false
Type boolean

Returns…

Description HTML representation
Type string

Return to the function index for this class Expand: View the source code to this function

tempcode ocportal_cleanup(?array caches)

Rebuild the specified caches.

Parameters…

Name caches
Description The caches to rebuild (NULL: all)
Default value
Type ?array

Returns…

Description Any messages returned
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void erase_tempcode_cache()

Erase the tempcode cache.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void erase_comcode_cache()

Erase the Comcode cache. Warning: This can take a long time on large sites, so is best to avoid.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void erase_cached_language()

Erase the language cache.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void erase_cached_templates(boolean preserve_some)

Erase all template caches (caches in all themes).

Parameters…

Name preserve_some
Description Whether to preserve CSS and JS files that might be linked to between requests
Default value boolean-false
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

string do_xhtml_validation(string out, boolean display_regardless, integer preview_mode, boolean ret)

Takes the output from the scripts, and check the XHTML for validity, then echoes the page, plus the validation results.

Parameters…

Name out
Description The XHTML to validate
Type string

Name display_regardless
Description Display XHTML output regardless of whether there was an error or not
Default value boolean-false
Type boolean

Name preview_mode
Description Whether we are opening up an XHTML-fragment in a preview box (0 means no, 1 means yes, 2 means we are asking for additional manual check information)
Default value 0
Type integer
Values restricted to 0 1 2

Name ret
Description Whether to return Tempcode
Default value boolean-false
Type boolean

Returns…

Description Returned result (won't return it $ret is false)
Type string

Return to the function index for this class Expand: View the source code to this function

string display_validation_results(string out, array error, boolean preview_mode, boolean ret)

Show results of running a validation function.

Parameters…

Name out
Description The data validated
Type string

Name error
Description Error information
Type array

Name preview_mode
Description Whether we are opening up an XHTML-fragment in a preview box
Default value boolean-false
Type boolean

Name ret
Description Whether to return Tempcode
Default value boolean-false
Type boolean

Returns…

Description Returned result (won't return it $ret is false)
Type string

Return to the function index for this class Expand: View the source code to this function