Ejemplo n.º 1
0
 public function read($id)
 {
     if (isset($this->sessions[$id])) {
         return (string) $this->sessions[$id];
     }
     $cache_key = $this->cacheKey($id);
     if (false !== ($sess = Pfw_Cache_Dist::get($cache_key))) {
         $this->sessions[$id] = $sess;
         return (string) $sess;
     }
     $where = $this->db->_sprintfEsc(array('session_id = %s', $id), true);
     $data = $this->db->fetchOne("SELECT `session_data` FROM `{$this->db_table}` WHERE {$where}");
     $session_data = (string) $data['session_data'];
     $this->sessions[$id] = $session_data;
     Pfw_Cache_Dist::set($cache_key, $session_data, self::CACHE_TTL);
     return $session_data;
 }
Ejemplo n.º 2
0
 protected function _toStringWhere()
 {
     $where_conds = array();
     if (!empty($this->where)) {
         foreach ($this->where as $alias => $where) {
             if (is_array($where)) {
                 $where = $this->adapter->_sprintfEsc($where);
             }
             array_push($where_conds, "({$where})");
         }
         return "WHERE " . implode($where_conds, " AND ");
     }
     return "";
 }