1Apache::Session::Store:U:sMeyrSQCLo(n3t)ributed Perl DocAupmaecnhtea:t:iSoenssion::Store::MySQL(3)
2
3
4
6 Apache::Session::Store::MySQL - Store persistent data in a MySQL
7 database
8
10 use Apache::Session::Store::MySQL;
11
12 my $store = new Apache::Session::Store::MySQL;
13
14 $store->insert($ref);
15 $store->update($ref);
16 $store->materialize($ref);
17 $store->remove($ref);
18
20 Apache::Session::Store::MySQL fulfills the storage interface of
21 Apache::Session. Session data is stored in a MySQL database.
22
24 To use this module, you will need at least these columns in a table
25 called 'sessions', or another table name if you provide the TableName
26 argument:
27
28 id char(32) # or however long your session IDs are.
29 a_session blob # or varbinary if you plan to use a big session (>64k after serialization)
30
31 To create this schema, you can execute this command using the mysql
32 program:
33
34 CREATE TABLE sessions (
35 id char(32) not null primary key,
36 a_session blob
37 );
38
39 If you use some other command, ensure that there is a unique index on
40 the table's id column.
41
43 The module must know what datasource, username, and password to use
44 when connecting to the database. These values can be set using the
45 options hash (see Apache::Session documentation). The options are:
46
47 DataSource
48 UserName
49 Password
50 TableName
51 Handle
52
53 Example:
54
55 tie %hash, 'Apache::Session::MySQL', $id, {
56 DataSource => 'dbi:mysql:database',
57 UserName => 'database_user',
58 Password => 'K00l',
59 TableName => 'sessions'
60 };
61
62 Instead, you may pass in an already-opened DBI handle to your database.
63
64 tie %hash, 'Apache::Session::MySQL', $id, {
65 Handle => $dbh
66 };
67
69 This modules was written by Jeffrey William Baker <jwbaker@acm.org>
70
72 Apache::Session
73
74
75
76perl v5.36.0 2023-01-19 Apache::Session::Store::MySQL(3)