1 | <?php |
||
45 | class TCacheHttpSession extends THttpSession |
||
46 | { |
||
47 | private $_prefix = 'session'; |
||
48 | private $_cacheModuleID = ''; |
||
49 | private $_cache; |
||
50 | |||
51 | /** |
||
52 | * Initializes the module. |
||
53 | * This method is required by IModule. |
||
54 | * It reads the CacheModule property. |
||
55 | * @param TXmlElement $config module configuration |
||
56 | */ |
||
57 | 10 | public function init($config) |
|
71 | |||
72 | /** |
||
73 | * @return string the ID of the cache module. |
||
74 | */ |
||
75 | 1 | public function getCacheModuleID() |
|
79 | |||
80 | /** |
||
81 | * @param string $value the ID of the cache module. |
||
82 | */ |
||
83 | 10 | public function setCacheModuleID($value) |
|
87 | |||
88 | /** |
||
89 | * @return ICache the cache module being used for data storage |
||
90 | */ |
||
91 | 1 | public function getCache() |
|
95 | |||
96 | /** |
||
97 | * Session read handler. |
||
98 | * @param string $id session ID |
||
99 | * @return string the session data |
||
100 | */ |
||
101 | public function _read($id) |
||
105 | |||
106 | /** |
||
107 | * Session write handler. |
||
108 | * @param string $id session ID |
||
109 | * @param string $data session data |
||
110 | * @return bool whether session write is successful |
||
111 | */ |
||
112 | public function _write($id, $data) |
||
116 | |||
117 | /** |
||
118 | * Session destroy handler. |
||
119 | * This method should be overriden if {@link setUseCustomStorage UseCustomStorage} is set true. |
||
120 | * @param string $id session ID |
||
121 | * @return bool whether session is destroyed successfully |
||
122 | */ |
||
123 | public function _destroy($id) |
||
127 | |||
128 | /** |
||
129 | * @return string prefix of session variable name to avoid conflict with other cache data. Defaults to 'session'. |
||
130 | */ |
||
131 | 1 | public function getKeyPrefix() |
|
135 | |||
136 | /** |
||
137 | * @param string $value prefix of session variable name to avoid conflict with other cache data |
||
138 | */ |
||
139 | 1 | public function setKeyPrefix($value) |
|
143 | |||
144 | /** |
||
145 | * @param string $id session variable name |
||
146 | * @return string a safe cache key associated with the session variable name |
||
147 | */ |
||
148 | protected function calculateKey($id) |
||
152 | } |
||
153 |