ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
ilGlobalCacheQueryWrapper Class Reference

Class ilGlobalCacheQueryWrapper. More...

+ Collaboration diagram for ilGlobalCacheQueryWrapper:

Public Member Functions

 __construct ($cache_key, $query, $fetch_type=self::FETCH_TYPE_OBJECT, $mode=self::MODE_SINGLE)
 
 get ()
 
 setFetchType ($fetch_type)
 
 getFetchType ()
 
 setMode ($mode)
 
 getMode ()
 

Data Fields

const FETCH_TYPE_ASSOC = 1
 
const FETCH_TYPE_OBJECT = 2
 
const MODE_SINGLE = 1
 
const MODE_MULTIPLE = 2
 

Protected Attributes

 $query = ''
 
 $cache_key = ''
 
 $fetch_type = self::FETCH_TYPE_OBJECT
 
 $mode = self::MODE_SINGLE
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGlobalCacheQueryWrapper::__construct (   $cache_key,
  $query,
  $fetch_type = self::FETCH_TYPE_OBJECT,
  $mode = self::MODE_SINGLE 
)
Parameters
$cache_key
$query
int$fetch_type
int$mode

Definition at line 40 of file class.ilGlobalCacheQueryWrapper.php.

References $cache_key, $fetch_type, $mode, and $query.

Member Function Documentation

◆ get()

ilGlobalCacheQueryWrapper::get ( )
Returns
array|mixed

Definition at line 51 of file class.ilGlobalCacheQueryWrapper.php.

References $ilDB, $res, getFetchType(), ilGlobalCache\getInstance(), and getMode().

51  {
52  $ilGlobalCache = ilGlobalCache::getInstance();
53  if ($ilGlobalCache->isActive()) {
54  $rec = $ilGlobalCache->get($this->cache_key);
55  if (! $rec) {
56  $rec = $this->getFromDb();
57  $ilGlobalCache->set($this->cache_key, $rec, 600);
58  }
59  } else {
60  $rec = $this->getFromDb();
61  }
62 
63  return $rec;
64  }
static getInstance($component)
+ Here is the call graph for this function:

◆ getFetchType()

ilGlobalCacheQueryWrapper::getFetchType ( )
Returns
int

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

References $fetch_type.

Referenced by get().

+ Here is the caller graph for this function:

◆ getMode()

ilGlobalCacheQueryWrapper::getMode ( )
Returns
int

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

References $mode.

Referenced by get().

+ Here is the caller graph for this function:

◆ setFetchType()

ilGlobalCacheQueryWrapper::setFetchType (   $fetch_type)
Parameters
int$fetch_type

Definition at line 101 of file class.ilGlobalCacheQueryWrapper.php.

References $fetch_type.

101  {
102  $this->fetch_type = $fetch_type;
103  }

◆ setMode()

ilGlobalCacheQueryWrapper::setMode (   $mode)
Parameters
int$mode

Definition at line 117 of file class.ilGlobalCacheQueryWrapper.php.

References $mode.

117  {
118  $this->mode = $mode;
119  }

Field Documentation

◆ $cache_key

ilGlobalCacheQueryWrapper::$cache_key = ''
protected

Definition at line 23 of file class.ilGlobalCacheQueryWrapper.php.

Referenced by __construct().

◆ $fetch_type

ilGlobalCacheQueryWrapper::$fetch_type = self::FETCH_TYPE_OBJECT
protected

Definition at line 27 of file class.ilGlobalCacheQueryWrapper.php.

Referenced by __construct(), getFetchType(), and setFetchType().

◆ $mode

ilGlobalCacheQueryWrapper::$mode = self::MODE_SINGLE
protected

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

Referenced by __construct(), getMode(), and setMode().

◆ $query

ilGlobalCacheQueryWrapper::$query = ''
protected

Definition at line 19 of file class.ilGlobalCacheQueryWrapper.php.

Referenced by __construct().

◆ FETCH_TYPE_ASSOC

const ilGlobalCacheQueryWrapper::FETCH_TYPE_ASSOC = 1

Definition at line 12 of file class.ilGlobalCacheQueryWrapper.php.

◆ FETCH_TYPE_OBJECT

const ilGlobalCacheQueryWrapper::FETCH_TYPE_OBJECT = 2

Definition at line 13 of file class.ilGlobalCacheQueryWrapper.php.

◆ MODE_MULTIPLE

const ilGlobalCacheQueryWrapper::MODE_MULTIPLE = 2

Definition at line 15 of file class.ilGlobalCacheQueryWrapper.php.

◆ MODE_SINGLE

const ilGlobalCacheQueryWrapper::MODE_SINGLE = 1

Definition at line 14 of file class.ilGlobalCacheQueryWrapper.php.


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