ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

Class ilGlobalCacheQueryWrapper.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0
Deprecated:
currently unused

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

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 42 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 53 of file class.ilGlobalCacheQueryWrapper.php.

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

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

◆ getFetchType()

ilGlobalCacheQueryWrapper::getFetchType ( )
Returns
int

Definition at line 112 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 128 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 104 of file class.ilGlobalCacheQueryWrapper.php.

References $fetch_type.

104  {
105  $this->fetch_type = $fetch_type;
106  }

◆ setMode()

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

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

References $mode.

120  {
121  $this->mode = $mode;
122  }

Field Documentation

◆ $cache_key

ilGlobalCacheQueryWrapper::$cache_key = ''
protected

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

Referenced by __construct().

◆ $fetch_type

ilGlobalCacheQueryWrapper::$fetch_type = self::FETCH_TYPE_OBJECT
protected

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

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

◆ $mode

ilGlobalCacheQueryWrapper::$mode = self::MODE_SINGLE
protected

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

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

◆ $query

ilGlobalCacheQueryWrapper::$query = ''
protected

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

Referenced by __construct().

◆ FETCH_TYPE_ASSOC

const ilGlobalCacheQueryWrapper::FETCH_TYPE_ASSOC = 1

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

◆ FETCH_TYPE_OBJECT

const ilGlobalCacheQueryWrapper::FETCH_TYPE_OBJECT = 2

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

◆ MODE_MULTIPLE

const ilGlobalCacheQueryWrapper::MODE_MULTIPLE = 2

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

◆ MODE_SINGLE

const ilGlobalCacheQueryWrapper::MODE_SINGLE = 1

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


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