protected function _get($key, $group, $tenant_id) { $ret = false; $result = $this->_db->from($this->_table)->where('key', $key)->where('group', $group)->where('tenant_id', $tenant_id)->get()->result(); if (!empty($result[0])) { $value = $this->_unserialize($result[0]->value); if ($value['expires'] > time()) { $ret = $value['data']; } else { $this->_delete($key, $group, $tenant_id); } } return $ret; }
/** * Load a record, by a specific ID, and by any attributes specified * * @param mixed $ID * @return bool */ public function load($ID = null) { if (is_object($ID)) { //Used by load many to initialise new objects //If it this object, or a fancy join? if (is_a($ID, 'stdClass')) { //This is just to strip from $this->_strip_row($ID); return true; } else { //Passed an object to load with $this->related($ID); } } //Did the user reauest via a specific ID? if (is_numeric($ID) or $ID === 0) { $this->db->where($this->_id(), $ID); } //Load in custom SQL //$this->_generate_related_sql_old(); $this->_generate_related_sql(); //Are there any variabloes set in the object to be used in the query? foreach ($this->_data as $Field => $Value) { $this->db->where($this->_table() . '.' . $Field, $Value); } $this->_data = array(); $this->db->select($this->_table() . '.*'); $this->db->from($this->_table()); $Query = $this->db->get(); if ($Query->num_rows() == 1) { $this->_strip_row($Query->row()); return true; } else { return false; } }