ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCache Class Reference

ILIAS Cache Class. More...

+ Collaboration diagram for ilCache:

Public Member Functions

 __construct ($a_module="common")
 Initialise Cache.
 getValue ($a_keyword)
 get cached value
 getValueForModule ($a_module, $a_keyword)
 get cached value
 deleteAll ($a_module="")
 Delete all cached values of a current module.
 deleteValue ($a_keyword)
 Delete a single value from the data cache public.
 setValue ($a_key, $a_val)
 Write a cached value.

Private Attributes

 $module = ""

Detailed Description

ILIAS Cache Class.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id:
class.ilCache.php 16998 2008-07-21 13:36:47Z hschottm

Definition at line 31 of file class.ilCache.php.

Constructor & Destructor Documentation

ilCache::__construct (   $a_module = "common")

Initialise Cache.

Definition at line 38 of file class.ilCache.php.

{
global $ilDB;
$this->module = $a_module;
}

Member Function Documentation

ilCache::deleteAll (   $a_module = "")

Delete all cached values of a current module.

Parameters
string$a_moduleA module or if empty, the current module public

Definition at line 109 of file class.ilCache.php.

References $module.

{
global $ilDB;
$module = (strlen($a_module) ? $a_module : $this->module);
$query = sprintf("DELETE FROM data_cache WHERE module = %s",
$ilDB->quote($module)
);
$ilDB->query($query);
}
ilCache::deleteValue (   $a_keyword)

Delete a single value from the data cache public.

Parameters
stringkeyword

Definition at line 125 of file class.ilCache.php.

{
global $ilDB;
$query = sprintf("DELETE FROM data_cache WHERE keyword = %s AND module = %s",
$ilDB->quote($a_keyword),
$ilDB->quote($this->module)
);
$ilDB->query($query);
}
ilCache::getValue (   $a_keyword)

get cached value

public

Parameters
stringkeyword
Returns
string value

Definition at line 53 of file class.ilCache.php.

References $res, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$query = sprintf("SELECT * FROM data_cache WHERE module = %s AND keyword = %s",
$ilDB->quote($this->module),
$ilDB->quote($a_keyword)
);
$res = $ilDB->query($query);
if ($res->numRows() == 1)
{
$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
return $row["value"];
}
else
{
return NULL;
}
}
ilCache::getValueForModule (   $a_module,
  $a_keyword 
)

get cached value

public

Parameters
stringmodule
stringkeyword
Returns
string value

Definition at line 82 of file class.ilCache.php.

References $res, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$query = sprintf("SELECT * FROM data_cache WHERE module = %s AND keyword = %s",
$ilDB->quote($a_module),
$ilDB->quote($a_keyword)
);
$res = $ilDB->query($query);
if ($res->numRows() == 1)
{
$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
return $row["value"];
}
else
{
return NULL;
}
}
ilCache::setValue (   $a_key,
  $a_val 
)

Write a cached value.

public

Parameters
string$a_keykeyword
string$a_valvalue

Definition at line 143 of file class.ilCache.php.

References $ilLog.

{
global $ilDB, $ilLog;
$sql = sprintf("DELETE FROM data_cache WHERE keyword = %s AND module = %s",
$ilDB->quote($a_key),
$ilDB->quote($this->module)
);
$ilDB->query($sql);
$sql = sprintf("INSERT INTO data_cache (module, keyword, value) VALUES (%s, %s, %s)",
$ilDB->quote($this->module),
$ilDB->quote($a_key),
$ilDB->quote($a_val)
);
$ilDB->query($sql);
}

Field Documentation

ilCache::$module = ""
private

Definition at line 33 of file class.ilCache.php.

Referenced by deleteAll().


The documentation for this class was generated from the following file: