| 155 | | the value stored when being execute it next time is returned. |
| | 154 | the value stored when being execute it next time is returned. |
| | 155 | |
| | 156 | =head2 SETTING OF CACHED DOMAIN |
| | 157 | |
| | 158 | In beginning logic or the start-up script: |
| | 159 | |
| | 160 | use Method::Cached; |
| | 161 | |
| | 162 | Method::Cached->default_domain({ |
| | 163 | storage_class => 'Cache::FastMmap', |
| | 164 | }); |
| | 165 | |
| | 166 | Method::Cached->set_domain( |
| | 167 | 'some-namespace' => { |
| | 168 | storage_class => 'Cache::Memcached::Fast', |
| | 169 | storage_args => [ |
| | 170 | { |
| | 171 | # Parameter of constructor of class that uses it for cashe |
| | 172 | servers => [ '192.168.254.2:11211', '192.168.254.3:11211' ], |
| | 173 | ... |
| | 174 | }, |
| | 175 | ], |
| | 176 | }, |
| | 177 | ); |
| | 178 | |
| | 179 | =head2 DEFINITION OF METHODS |
| | 180 | |
| | 181 | This function is mounting used as an attribute of the method. |
| | 182 | |
| | 183 | =over 4 |
| | 184 | |
| | 185 | =item B<:Cached ( DOMAIN_NAME, EXPIRES, [, KEY_RULE, ...] )> |
| | 186 | |
| | 187 | The cached rule is defined specifying the domain name. |
| | 188 | |
| | 189 | sub message :Cached('some-namespace', 60 * 5, LIST) { ... } |
| | 190 | |
| | 191 | =item B<:Cached ( EXPIRES, [, KEY_RULE, ...] )> |
| | 192 | |
| | 193 | When the domain name is omitted, the domain of default is used. |
| | 194 | |
| | 195 | sub message :Cached(60 * 30, LIST) { ... } |
| | 196 | |
| | 197 | =back |
| | 198 | |
| | 199 | =head2 RULE TO GENERATE KEY |
| | 200 | |
| | 201 | =over 4 |
| | 202 | |
| | 203 | =item B<LIST> |
| | 204 | |
| | 205 | =item B<SERIALIZE> |
| | 206 | |
| | 207 | =item B<SELF_SHIFT> |
| | 208 | |
| | 209 | =item B<SELF_CODED> |
| | 210 | |
| | 211 | =item B<PER_OBJECT> |
| | 212 | |
| | 213 | =back |
| | 214 | |
| | 215 | =head1 METHODS |
| | 216 | |
| | 217 | =over 4 |
| | 218 | |
| | 219 | =item B<default_domain ($setting)> |
| | 220 | |
| | 221 | =item B<set_domain (%domain_settings)> |
| | 222 | |
| | 223 | =item B<get_domain ($domain_name)> |
| | 224 | |
| | 225 | =back |