1Catalyst::Plugin::SessiUosne:r:SCtoonrter:i:bCDuaettleaedlgyaPsteter:(l:3P)Dloucguimne:n:tSaetsisoinon::Store::Delegate(3)
2
3
4
6 Catalyst::Plugin::Session::Store::Delegate - Delegate session storage
7 to an application model object.
8
10 use Catalyst::Plugin::Session::Store::Delegate;
11
13 This store plugins makes delegating session storage to a first class
14 object model easy.
15
17 The model is used to retrieve the delegate object for a given session
18 ID.
19
20 This is normally something like DBIC's resultset object.
21
22 The model must respond to the "get_delegate" method or closure in the
23 sesion config hash (defaults to "get_session_store_delegate").
24
25 An object must always be returned from this method, even if it means
26 autovivifying. The object may optimize and create itself lazily in the
27 actual store only when ->store methods are actually called.
28
30 A single delegate belongs to a single session ID. It provides storage
31 space for arbitrary fields.
32
33 The delegate object must respond to method calls as per the
34 "session_store_delegate_key_to_accessor" method's return values.
35
36 Typically this means responding to $obj->$field type accessors.
37
38 If necessary, the delegate should maintain an internal reference count
39 of the stored fields, so that it can garbage collect itself when all
40 fields have been deleted.
41
42 The fields are arbitrary, and are goverend by the various session
43 plugins.
44
45 The basic keys that must be supported are:
46
47 expires
48 A timestamp indicating when the session will expire.
49
50 If a store so chooses it may clean up session data after this
51 timestamp, even without being told to delete.
52
53 session
54 The main session data hash.
55
56 Might not be used, if only "flash" exists.
57
58 flash
59 A hash much like the main session data hash, which can be created
60 and deleted multiple times per session, as required.
61
62 The delegate must also respond to the "flush" method which is used to
63 tell the store delegate that no more set/get/delete methods will be
64 invoked on it.
65
67 session_store_delegate_key_to_accessor $key, $operation
68 This method implements the various calling conventions. It accepts
69 a key and an operation name ("get", "set" or "delete"), and must
70 return a method (could be a string or a code reference), and an
71 optional list of arguments that will be invoked on the delegate.
72
73 The default version splits $key on the first colon, extracting the
74 field name and the ID. It then returns the unaltered field name,
75 and if the operation is 'delete' also provides the extra argument
76 "undef". This works with accessor semantics like these:
77
78 $obj->foo;
79 $obj->foo("bar");
80 $obj->foo(undef);
81
82 To facilitate a convention like
83
84 $obj->get_foo;
85 $obj->set_foo("bar");
86 $obj->delete_foo;
87
88 or
89
90 $obj->get("foo");
91 $obj->set("foo", "bar");
92 $obj->delete("foo");
93
94 simply override this method. You may look in the source of this
95 module to find commented out versions which should help you.
96
97 session_store_delegate
98 This method returns the delegate, which may be cached in $c.
99
100 get_session_store_delegate $id
101 This method should get the delegate object for a given ID. See "THE
102 MODEL" for more details.
103
104 session_store_model
105 This method should return the model that will provide the delegate
106 object.The default implementation will simply return "$c->model(
107 $c->session_store_model_name )".
108
109 session_store_model_name
110 Returns "$c->config->{session}{model_name} || "Sessions"".
111
112 finalize_session_delegate $delegate
113 Invokes the "flush" method on the delegate. May be overridden if
114 that behavior is inappropriate.
115
116 get_session_data $key
117 store_session_data $key, $value
118 delete_session_data $key
119 These methods translate the store API into the delegate API using
120 "session_store_delegate_key_to_accessor".
121
123 Yuval Kogman, "nothingmuch@woobling.org"
124
125 Tomas Doran, (t0m) "bobtfish@bobtfish.net" (current maintainer)
126
128 Copyright (c) 2006 the aforementioned authors. This program is free
129 software; you can redistribute it and/or modify it under the same terms
130 as Perl itself.
131
132
133
134perl v5.32.0 C2a0t2a0l-y0s7t-:2:8Plugin::Session::Store::Delegate(3)