HTTP_Session2
[ class tree: HTTP_Session2 ] [ index: HTTP_Session2 ] [ all elements ]

Class: HTTP_Session2_Container_DB

Source Location: /HTTP_Session2-0.7.0/HTTP/Session2/Container/DB.php

Class Overview

HTTP_Session2_Container
   |
   --HTTP_Session2_Container_DB

Database container for session data


Author(s):

Version:

  • Release: @package_version@

Methods


Inherited Variables

Inherited Methods

Class: HTTP_Session2_Container

HTTP_Session2_Container::__construct()
Constrtuctor method
HTTP_Session2_Container::parseOptions()
Parse options passed to the container class
HTTP_Session2_Container::set()
Set session save handler
HTTP_Session2_Container::setDefaults()
Set some default options

Class Details

[line 85]
Database container for session data

Create the following table to store session data

  1.  CREATE TABLE `sessiondata` (
  2.      `id` CHAR(32NOT NULL,
  3.      `expiry` INT UNSIGNED NOT NULL DEFAULT 0,
  4.      `data` TEXT NOT NULL,
  5.      PRIMARY KEY (`id`)
  6.  );



[ Top ]


Method Detail

__construct (Constructor)   [line 118]

void __construct( array $options)

Constrtuctor method

$options is an array with the options.
The options are:

  • 'dsn' - The DSN string
  • 'table' - Table with session data, default is 'sessiondata'
  • 'autooptimize' - Boolean, 'true' to optimize the table on garbage collection, default is 'false'.

  • Access: public

Overrides HTTP_Session2_Container::__construct() (Constrtuctor method)

Parameters:

array   $options   —  The options

[ Top ]

close   [line 183]

boolean close( )

Free resources
  • Access: public

[ Top ]

connect   [line 131]

boolean connect( string $dsn)

Connect to database by using the given DSN string
  • Throws: HTTP_Session2_Exception An exception?!
  • Access: protected

Parameters:

string   $dsn   —  DSN string

[ Top ]

destroy   [line 278]

boolean destroy( string $id)

Destroy session data
  • Access: public

Parameters:

string   $id   —  The id.

[ Top ]

gc   [line 300]

boolean gc( int $maxlifetime)

Garbage collection
  • Todo: Find out why the DB is not used for garbage collection.
  • Access: public

Parameters:

int   $maxlifetime   —  The session's maximum lifetime.

[ Top ]

open   [line 173]

boolean open( string $save_path, string $session_name)

Establish connection to a database
  • Access: public
  • Uses: self::connect();
  • Uses: self::$options

Parameters:

string   $save_path   —  The path to save/write sessions.
string   $session_name   —  The session name.

[ Top ]

read   [line 196]

mixed read( string $id)

Read session data
  • Throws: HTTP_Session2_Exception An exception!?
  • Access: public

Parameters:

string   $id   —  The Id!

[ Top ]

replicate   [line 344]

boolean replicate( string $target, [string $id = null])

Replicate session data to specified target
  • Access: public

Parameters:

string   $target   —  Target to replicate to
string   $id   —  Id of record to replicate, if not specified current session id will be used

[ Top ]

setDefaults   [line 156]

void setDefaults( )

Set some default options
  • Access: protected

Overrides HTTP_Session2_Container::setDefaults() (Set some default options)
[ Top ]

write   [line 221]

boolean write( string $id, string $data)

Write session data
  • Todo: Remove sprintf(), they are expensive.
  • Access: public

Parameters:

string   $id   —  The id.
string   $data   —  The data.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:16:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.