ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

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)

References ilGlobalCache\getInstance().

+ Here is the call graph for this function:

◆ getFetchType()

ilGlobalCacheQueryWrapper::getFetchType ( )
Returns
int

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

109 {
110 return $this->fetch_type;
111 }

References $fetch_type.

◆ getMode()

ilGlobalCacheQueryWrapper::getMode ( )
Returns
int

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

125 {
126 return $this->mode;
127 }

References $mode.

◆ setFetchType()

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

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

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

References $fetch_type.

◆ setMode()

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

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

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

References $mode.

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: