Actions

API15

Difference between revisions of "JCache/getInstance"

From Joomla! Documentation

< API15:JCache
(New page: ===Description=== Returns a reference to a cache adapter object, always creating it <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JCache/getInstanc...)
 
m (removing red link to edit, no existant pages)
 
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JCache/getInstance|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JCache/getInstance}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 60: Line 60:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JCache/getInstance|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JCache/getInstance}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
Line 75: Line 75:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Latest revision as of 08:48, 12 May 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Returns a reference to a cache adapter object, always creating it

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

& getInstance($type= 'output', $options=array())
Parameter Name Default Value Description
$type 'output' $type The cache object type to instantiate
$options array()

Returns

object A object

Defined in

libraries/joomla/cache/cache.php

Importing

jimport( 'joomla.cache.cache' );

Source Body

function &getInstance($type = 'output', $options = array())
{
        $type = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $type));
 
        $class = 'JCache'.ucfirst($type);
 
        if(!class_exists($class))
        {
                $path = dirname(__FILE__).DS.'handler'.DS.$type.'.php';
 
                if (file_exists($path)) {
                        require_once($path);
                } else {
                        JError::raiseError(500, 'Unable to load Cache Handler: '.$type);
                }
        }
 
        $instance = new $class($options);
 
        return $instance;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />