root/software/session2/trunk/epydoc-html/session2.store.DirectorySessionStore.DirectorySessionStore-class.html

Revision 12, 14.5 kB (checked in by t, 12 years ago)

Moved VolatileSessionStore? over to MemorySessionStore? (MO)

Line 
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3           "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6   <title>session2.store.DirectorySessionStore.DirectorySessionStore</title>
7   <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
8 </head>
9 <body bgcolor="white" text="black" link="blue" vlink="#204080"
10       alink="#204080">
11
12 <!-- =========== START OF NAVBAR =========== -->
13 <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
14   <tr valign="center">
15     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="session2-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
16     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
17     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
18     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
19     <th class="navbar" align="right" width="100%">
20       <table border="0" cellpadding="0" cellspacing="0">
21       <tr><th class="navbar" align="center">
22         <p class="nomargin">
23           session2
24       </p></th></tr></table>
25     </th>
26   </tr>
27 </table>
28 <table width="100%" cellpadding="0" cellspacing="0">
29   <tr valign="top">
30     <td width="100%">
31       <font size="-1"><b class="breadcrumbs">
32         <a href="session2-module.html">Package&nbsp;session2</a> ::
33         <a href="session2.store-module.html">Package&nbsp;store</a> ::
34         <a href="session2.store.DirectorySessionStore-module.html">Module&nbsp;DirectorySessionStore</a> ::
35         Class&nbsp;DirectorySessionStore
36       </b></font></br>
37     </td>
38     <td><table cellpadding="0" cellspacing="0">
39       <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
40     </table></td>
41 </tr></table>
42
43 <!-- =========== START OF CLASS DESCRIPTION =========== -->
44 <h2 class="class">Class DirectorySessionStore</h2>
45
46 <pre class="base-tree">
47 <a href="session2.store.SessionStore.SessionStore-class.html"><code>SessionStore</code></a> --+
48                |
49               <b>DirectorySessionStore</b>
50 </pre><br />
51
52 <hr/>
53
54 <pre class="literalblock">
55 Store sessions in individual files within a directory.
56 </pre>
57 <hr/>
58
59
60 <!-- =========== START OF METHOD SUMMARY =========== -->
61 <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
62 <tr bgcolor="#70b0f0" class="summary">
63   <th colspan="2">Method Summary</th></tr>
64 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
65   <td><code><span class="summary-sig"><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#__init__" class="summary-sig-name"><code>__init__</code></a>(<span class=summary-sig-arg>self</span>,
66           <span class=summary-sig-arg>directory</span>,
67           <span class=summary-sig-arg>create</span>)</span></code>
68 <br />
69 __init__ takes a directory name, with an option to create it if
70 it's not already there.</td></tr>
71 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
72   <td><code><span class="summary-sig"><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#delete_old_sessions" class="summary-sig-name"><code>delete_old_sessions</code></a>(<span class=summary-sig-arg>self</span>,
73           <span class=summary-sig-arg>minutes</span>)</span></code>
74 <br />
75 Delete all sessions that have not been modified for N minutes.</td></tr>
76 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
77   <td><code><span class="summary-sig"><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#delete_session" class="summary-sig-name"><code>delete_session</code></a>(<span class=summary-sig-arg>self</span>,
78           <span class=summary-sig-arg>session</span>)</span></code>
79 <br />
80 Delete the session file.</td></tr>
81 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
82   <td><code><span class="summary-sig"><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#load_session" class="summary-sig-name"><code>load_session</code></a>(<span class=summary-sig-arg>self</span>,
83           <span class=summary-sig-arg>id</span>,
84           <span class=summary-sig-arg>default</span>)</span></code>
85 <br />
86 Load the pickled session from a file.</td></tr>
87 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
88   <td><code><span class="summary-sig"><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#save_session" class="summary-sig-name"><code>save_session</code></a>(<span class=summary-sig-arg>self</span>,
89           <span class=summary-sig-arg>session</span>)</span></code>
90 <br />
91 Pickle the session and save it into a file.</td></tr>
92 <tr bgcolor="#e8f0f8" class="group">
93   <th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;Inherited from SessionStore</th></tr>
94 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
95   <td><code><span class="summary-sig"><a href="session2.store.SessionStore.SessionStore-class.html#has_session" class="summary-sig-name"><code>has_session</code></a>(<span class=summary-sig-arg>self</span>,
96           <span class=summary-sig-arg>id</span>)</span></code>
97 <br />
98 Return true if the session exists in the store, else false.</td></tr>
99 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
100   <td><code><span class="summary-sig"><a href="session2.store.SessionStore.SessionStore-class.html#iter_sessions" class="summary-sig-name"><code>iter_sessions</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
101 <br />
102 Return an iterable of (id, session) for all sessions in the store.</td></tr>
103 <tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
104   <td><code><span class="summary-sig"><a href="session2.store.SessionStore.SessionStore-class.html#setup" class="summary-sig-name"><code>setup</code></a>(<span class=summary-sig-arg>self</span>)</span></code>
105 <br />
106 Initialize the session store; e.g., create required database tables.</td></tr>
107 </table><br />
108
109
110 <!-- =========== START OF CLASS VARIABLE SUMMARY =========== -->
111 <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
112 <tr bgcolor="#70b0f0" class="summary">
113   <th colspan="2">Class Variable Summary</th></tr>
114 <tr><td align="right" valign="top" width="15%"><font size="-1"><code>bool</code></font></td>
115 <td><b><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#is_multiprocess_safe"><code>is_multiprocess_safe</code></a></b> = <span title="True"><code>True                              </code>
116 </span></td></tr>
117 <tr><td align="right" valign="top" width="15%"><font size="-1"><code>bool</code></font></td>
118 <td><b><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#is_thread_safe"><code>is_thread_safe</code></a></b> = <span title="False"><code>False                                   </code>
119 </span></td></tr>
120 <tr><td align="right" valign="top" width="15%"><font size="-1"><code>int</code></font></td>
121 <td><b><a href="session2.store.DirectorySessionStore.DirectorySessionStore-class.html#pickle_protocol"><code>pickle_protocol</code></a></b> = <span title="2">2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>
122 </table><br />
123
124
125 <!-- =========== START OF METHOD DETAILS =========== -->
126 <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
127 <tr bgcolor="#70b0f0" class="details">
128   <th colspan="2">Method Details</th></tr>
129 </table>
130
131 <a name="__init__"></a>
132 <table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
133   <h3><span class="sig"><span class="sig-name">__init__</span>(<span class=sig-arg>self</span>,
134           <span class=sig-arg>directory</span>,
135           <span class=sig-arg>create</span>=<span class=sig-default>False</span>)</span>
136     <br /><i>(Constructor)</i>
137   </h3>
138 <pre class="literalblock">
139 __init__ takes a directory name, with an option to create it if
140 it's not already there.
141 </pre>
142   <dl><dt></dt><dd>
143   </dd></dl>
144 </td></tr></table>
145
146 <a name="delete_old_sessions"></a>
147 <table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
148   <h3><span class="sig"><span class="sig-name">delete_old_sessions</span>(<span class=sig-arg>self</span>,
149           <span class=sig-arg>minutes</span>)</span>
150   </h3>
151 <pre class="literalblock">
152 Delete all sessions that have not been modified for N minutes.
153
154 This method is never called by the session manager.  It's for
155 your application maintenance program; e.g., a daily cron job.
156
157 DirectorySessionStore.delete_old_sessions returns a tuple:
158    (n_deleted, n_remaining)
159 </pre>
160   <dl><dt></dt><dd>
161     <dl><dt><b>Overrides:</b></dt>
162       <dd><a href="session2.store.SessionStore.SessionStore-class.html#delete_old_sessions"><code>session2.store.SessionStore.SessionStore.delete_old_sessions</code></a></dd>
163     </dl>
164   </dd></dl>
165 </td></tr></table>
166
167 <a name="delete_session"></a>
168 <table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
169   <h3><span class="sig"><span class="sig-name">delete_session</span>(<span class=sig-arg>self</span>,
170           <span class=sig-arg>session</span>)</span>
171   </h3>
172 <pre class="literalblock">
173 Delete the session file.
174 </pre>
175   <dl><dt></dt><dd>
176     <dl><dt><b>Overrides:</b></dt>
177       <dd><a href="session2.store.SessionStore.SessionStore-class.html#delete_session"><code>session2.store.SessionStore.SessionStore.delete_session</code></a></dd>
178     </dl>
179   </dd></dl>
180 </td></tr></table>
181
182 <a name="load_session"></a>
183 <table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
184   <h3><span class="sig"><span class="sig-name">load_session</span>(<span class=sig-arg>self</span>,
185           <span class=sig-arg>id</span>,
186           <span class=sig-arg>default</span>=<span class=sig-default>None</span>)</span>
187   </h3>
188 <pre class="literalblock">
189 Load the pickled session from a file.
190 </pre>
191   <dl><dt></dt><dd>
192     <dl><dt><b>Overrides:</b></dt>
193       <dd><a href="session2.store.SessionStore.SessionStore-class.html#load_session"><code>session2.store.SessionStore.SessionStore.load_session</code></a></dd>
194     </dl>
195   </dd></dl>
196 </td></tr></table>
197
198 <a name="save_session"></a>
199 <table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
200   <h3><span class="sig"><span class="sig-name">save_session</span>(<span class=sig-arg>self</span>,
201           <span class=sig-arg>session</span>)</span>
202   </h3>
203 <pre class="literalblock">
204 Pickle the session and save it into a file.
205 </pre>
206   <dl><dt></dt><dd>
207     <dl><dt><b>Overrides:</b></dt>
208       <dd><a href="session2.store.SessionStore.SessionStore-class.html#save_session"><code>session2.store.SessionStore.SessionStore.save_session</code></a></dd>
209     </dl>
210   </dd></dl>
211 </td></tr></table>
212 <br />
213
214
215 <!-- =========== START OF CLASS VARIABLE DETAILS =========== -->
216 <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
217 <tr bgcolor="#70b0f0" class="details">
218   <th colspan="2">Class Variable Details</th></tr>
219 </table>
220 <table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
221 <a name="is_multiprocess_safe"></a>
222 <h3>is_multiprocess_safe</h3>
223 <dl>
224   <dt></dt>
225   <dd>
226     <dl>
227       <dt><b>Type:</b></dt>
228       <dd>
229           <code>bool</code>
230
231       </dd>
232 <span title="True">      <dt><b>Value:</b></dt>
233       <dd><table><tr><td>
234 <pre class="variable">
235 True                                                                   </pre>
236         </td></tr></table></dd>
237 </span>    </dl>
238   </dd>
239 </dl></td></tr></table>
240 <table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
241 <a name="is_thread_safe"></a>
242 <h3>is_thread_safe</h3>
243 <dl>
244   <dt></dt>
245   <dd>
246     <dl>
247       <dt><b>Type:</b></dt>
248       <dd>
249           <code>bool</code>
250
251       </dd>
252 <span title="False">      <dt><b>Value:</b></dt>
253       <dd><table><tr><td>
254 <pre class="variable">
255 False                                                                  </pre>
256         </td></tr></table></dd>
257 </span>    </dl>
258   </dd>
259 </dl></td></tr></table>
260 <table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
261 <a name="pickle_protocol"></a>
262 <h3>pickle_protocol</h3>
263 <dl>
264   <dt></dt>
265   <dd>
266     <dl>
267       <dt><b>Type:</b></dt>
268       <dd>
269           <code>int</code>
270
271       </dd>
272 <span title="2">      <dt><b>Value:</b></dt>
273       <dd><table><tr><td>
274 <pre class="variable">
275 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</pre>
276         </td></tr></table></dd>
277 </span>    </dl>
278   </dd>
279 </dl></td></tr></table>
280 <br />
281
282
283 <!-- =========== START OF NAVBAR =========== -->
284 <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
285   <tr valign="center">
286     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="session2-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
287     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
288     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
289     <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
290     <th class="navbar" align="right" width="100%">
291       <table border="0" cellpadding="0" cellspacing="0">
292       <tr><th class="navbar" align="center">
293         <p class="nomargin">
294           session2
295       </p></th></tr></table>
296     </th>
297   </tr>
298 </table>
299
300 <table border="0" cellpadding="0" cellspacing="0" width="100%">
301   <tr>
302     <td align="left"><font size="-2">Generated by Epydoc 2.1 on Sun Oct 15 21:33:50 2006</font></td>
303     <td align="right"><a href="http://epydoc.sourceforge.net"
304                       ><font size="-2">http://epydoc.sf.net</font></a></td>
305   </tr>
306 </table>
307 </body>
308 </html>
Note: See TracBrowser for help on using the browser.