• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/Dancer2/Session/H22-Sep-2018-745267

t/H22-Sep-2018-865647

CHANGESH A D22-Sep-20182.4 KiB9156

MANIFESTH A D22-Sep-2018746 2827

MANIFEST.SKIPH A D09-Apr-201449 65

META.jsonH A D22-Sep-20181.7 KiB6665

META.ymlH A D22-Sep-20181,016 3938

Makefile.PLH A D07-Jul-20162 KiB8671

READMEH A D22-Sep-20184.4 KiB182109

README

1NAME
2
3    Dancer2::Session::DBIC - DBIx::Class session engine for Dancer2
4
5VERSION
6
7    0.120
8
9DESCRIPTION
10
11    This module implements a session engine for Dancer2 by serializing the
12    session, and storing it in a database via DBIx::Class.
13
14    JSON was chosen as the default serialization format, as it is fast,
15    terse, and portable.
16
17SYNOPSIS
18
19    Example configuration:
20
21        session: "DBIC"
22        engines:
23          session:
24            DBIC:
25              dsn:      "DBI:mysql:database=testing;host=127.0.0.1;port=3306" # DBI Data Source Name
26              schema_class:    "Interchange6::Schema"  # DBIx::Class schema
27              user:     "user"      # Username used to connect to the database
28              password: "password"  # Password to connect to the database
29              resultset: "MySession" # DBIx::Class resultset, defaults to Session
30              id_column: "my_session_id" # defaults to sessions_id
31              data_column: "my_session_data" # defaults to session_data
32              serializer: "YAML"    # defaults to JSON
33
34    Or if you are already using Dancer2::Plugin::DBIC and want to use its
35    existing configuration for a database section named 'default' with all
36    else set to default in this module then you could simply use:
37
38        session: "DBIC"
39        engines:
40          session:
41            DBIC:
42              db_connection_name: default
43
44SESSION EXPIRATION
45
46    A timestamp field that updates when a session is updated is
47    recommended, so you can expire sessions server-side as well as
48    client-side.
49
50    This session engine will not automagically remove expired sessions on
51    the server, but with a timestamp field as above, you should be able to
52    to do this manually.
53
54ATTRIBUTES
55
56 schema_class
57
58    DBIx::Class schema class, e.g. Interchange6::Schema.
59
60 db_connection_name
61
62    The Dancer2::Plugin::DBIC database connection name.
63
64    If this option is provided then "schema_class", "dsn", "user" and
65    "password" are all ignored.
66
67 resultset
68
69    DBIx::Class resultset, defaults to Session.
70
71 id_column
72
73    Column for session id, defaults to sessions_id.
74
75    If this column is not the primary key of the table, it should have a
76    unique constraint added to it. See "add_unique_constraint" in
77    DBIx::Class::ResultSource.
78
79 data_column
80
81    Column for session data, defaults to session_data.
82
83 dsn
84
85    DBI dsn to connect to the database.
86
87 user
88
89    Database username.
90
91 password
92
93    Database password.
94
95 schema
96
97    DBIx::Class schema.
98
99 serializer
100
101    Serializer to use, defaults to JSON.
102
103    Dancer2::Session::DBIC provides the following serializer classes:
104
105    JSON - Dancer2::Session::DBIC::Serializer::JSON
106
107    Sereal - Dancer2::Session::DBIC::Serializer::Sereal
108
109    YAML - Dancer2::Session::DBIC::Serializer::YAML
110
111    If you do not use the default JSON serializer then you might need to
112    install additional modules - see the specific serializer class for
113    details.
114
115    You can also use your own serializer class by passing the
116    fully-qualified class name as argument to this option, e.g.:
117    MyApp::Session::Serializer
118
119 serializer_object
120
121    Vivified "serializer" object.
122
123 serialize_options
124
125    Options to be passed to the constructor of the serializer class as a
126    hash reference.
127
128 deserialize_options
129
130    Options to be passed to the constructor of the deserializer class as a
131    hash reference.
132
133METHODS
134
135 _flush
136
137    Write the session to the database. Returns the session object.
138
139 _retrieve($id)
140
141    Look for a session with the given id.
142
143    Returns the session object if found, undef if not. Dies if the session
144    was found, but could not be deserialized.
145
146 _change_id( $old_id, $new_id )
147
148    Change ID of session with $old_id to <$new_id>.
149
150 _destroy()
151
152    Remove the current session object from the database.
153
154SEE ALSO
155
156    Dancer2, Dancer2::Session
157
158AUTHOR
159
160    Stefan Hornburg (Racke) <racke@linuxia.de>
161
162ACKNOWLEDGEMENTS
163
164    Based on code from Dancer::Session::DBI written by James Aitken and
165    code from Dancer::Plugin::DBIC written by Naveed Massjouni.
166
167    Peter Mottram, support for JSON, YAML, Sereal and custom serializers,
168    GH #8, #9, #11, #12. Also for adding _change_id method and accompanying
169    tests.
170
171    Rory Zweistra, GH #9.
172
173    Andy Jack, GH #2.
174
175COPYRIGHT AND LICENSE
176
177    This software is copyright (c) Stefan Hornburg.
178
179    This is free software; you can redistribute it and/or modify it under
180    the same terms as the Perl 5 programming language system itself.
181
182