Index: trunk/phase3/includes/MemcachedSessions.php |
— | — | @@ -11,30 +11,42 @@ |
12 | 12 | */ |
13 | 13 | |
14 | 14 | /** |
15 | | - * @todo document |
| 15 | + * Get a cache key for the given session id. |
| 16 | + * |
| 17 | + * @param $id String: session id |
| 18 | + * @return String: cache key |
16 | 19 | */ |
17 | 20 | function memsess_key( $id ) { |
18 | 21 | return wfMemcKey( 'session', $id ); |
19 | 22 | } |
20 | 23 | |
21 | 24 | /** |
22 | | - * @todo document |
| 25 | + * Callback when opening a session. |
| 26 | + * NOP: $wgMemc should be set up already. |
| 27 | + * |
| 28 | + * @param $save_path String: path used to store session files, unused |
| 29 | + * @param $session_name String: session name |
| 30 | + * @return Boolean: success |
23 | 31 | */ |
24 | 32 | function memsess_open( $save_path, $session_name ) { |
25 | | - # NOP, $wgMemc should be set up already |
26 | 33 | return true; |
27 | 34 | } |
28 | 35 | |
29 | 36 | /** |
30 | | - * @todo document |
| 37 | + * Callback when closing a session. |
| 38 | + * NOP. |
| 39 | + * |
| 40 | + * @return Boolean: success |
31 | 41 | */ |
32 | 42 | function memsess_close() { |
33 | | - # NOP |
34 | 43 | return true; |
35 | 44 | } |
36 | 45 | |
37 | 46 | /** |
38 | | - * @todo document |
| 47 | + * Callback when reading session data. |
| 48 | + * |
| 49 | + * @param $id String: session id |
| 50 | + * @return Mixed: session data |
39 | 51 | */ |
40 | 52 | function memsess_read( $id ) { |
41 | 53 | global $wgMemc; |
— | — | @@ -44,7 +56,11 @@ |
45 | 57 | } |
46 | 58 | |
47 | 59 | /** |
48 | | - * @todo document |
| 60 | + * Callback when writing session data. |
| 61 | + * |
| 62 | + * @param $id String: session id |
| 63 | + * @param $data Mixed: session data |
| 64 | + * @return Boolean: success |
49 | 65 | */ |
50 | 66 | function memsess_write( $id, $data ) { |
51 | 67 | global $wgMemc; |
— | — | @@ -53,19 +69,26 @@ |
54 | 70 | } |
55 | 71 | |
56 | 72 | /** |
57 | | - * @todo document |
| 73 | + * Callback to destroy a session when calling session_destroy(). |
| 74 | + * |
| 75 | + * @param $id String: session id |
| 76 | + * @return Boolean: success |
58 | 77 | */ |
59 | 78 | function memsess_destroy( $id ) { |
60 | 79 | global $wgMemc; |
| 80 | + |
61 | 81 | $wgMemc->delete( memsess_key( $id ) ); |
62 | 82 | return true; |
63 | 83 | } |
64 | 84 | |
65 | 85 | /** |
66 | | - * @todo document |
| 86 | + * Callback to execute garbage collection. |
| 87 | + * NOP: Memcached performs garbage collection. |
| 88 | + * |
| 89 | + * @param $maxlifetime Integer: maximum session life time |
| 90 | + * @return Boolean: success |
67 | 91 | */ |
68 | 92 | function memsess_gc( $maxlifetime ) { |
69 | | - # NOP: Memcached performs garbage collection. |
70 | 93 | return true; |
71 | 94 | } |
72 | 95 | |