public function write($id, $value) { $sessions_table = new Sessions(); $lifetime = (int) Bolts_Registry::get('session_timeout'); $expiration = time() + $lifetime; $data = array('id' => $id, 'value' => $value, 'expiration' => $expiration); $where = $sessions_table->getAdapter()->quoteInto('id = ?', $id); if ($sessions_table->getCountByWhereClause($where) > 0) { $sessions_table->update($data, $where); } else { $id = $sessions_table->insert($data); } }