alan
alan

Reputation: 241

How Kohana implement sessions saved to database?

the source code hands Session_Cookie and Session_Native class but the Session_Database, here the config file

<?php defined('SYSPATH') or die('No direct script access.');

    return array(
        'database'  =>  array(
            'database' => array(
            'name' => 'blog_session_cookie',
            'encrypted' => TRUE,
            'lifetime' => 43200,
            'group' => 'default',
            'table' => 'sessions',
            'columns' => array(
                'session_id'  => 'session_id',
                'last_active' => 'last_active',
                'contents'    => 'contents'
            ),
            'gc' => 500,
        ),
        ),
    );

usage

    $session = Session::Instance("Database");
    $session->set('username', 'far');

great, its added a column in database, amusing! How the core do that? thank you.

Upvotes: 0

Views: 251

Answers (2)

s.webbandit
s.webbandit

Reputation: 17000

To implement database session mechanism there is Auth_ORM class in Kohana 3.2.

Upvotes: 0

zerkms
zerkms

Reputation: 254926

It's handled by Session_Database class in Database module

See the source: https://github.com/kohana/database/blob/3.2/master/classes/kohana/session/database.php

Upvotes: 1

Related Questions