NAME

Egg::Model::Cache - Model for cashe.

SYNOPSIS

my $cahce= $e->model('cache_label');

# Data is set in the cache.
$cache->set( data_name => 'HOGE' );

# Data is acquired from cashe.
my $data= $cache->get('data_name');

# Cashe is deleted.
$cache->remove('data_name');

DESCRIPTION

It is a model to use cashe.

To use it, the CACHE controller is generated under the control of the project with the helper.

see Egg::Helper::Model::Cache.

% cd /path/to/MyApp/bin
% ./egg_helper M::Cache [MODULE_NAME]

The CACHE controller is set up when the project is started by this and using it becomes possible.

Two or more CACHE controllers can be used at the same time.

HOW TO CACHE CONTROLLER

It is necessary to set up the cashe module used by 'setup_cache' method in the CACHE controller.

__PACKAGE__->setup_cache('Cache::FileCache');

It is Cache::FileCache in default, and the thing changed to an arbitrary module can be done.

The data set by the config method is passed by the constructor of all modules set up by 'setup_cache'.

When 'label_name' is set, the model call can be done by an arbitrary label name.

__PACKAGE__->config(
  label_name => 'mylabel',
  );

my $cache= $e->model('mylabel');

Additionally, please construct the CACHE controller while arbitrarily adding a convenient code to obtain the cash data.

METHODS

Please refer to Egg::Model::Cache::Base for the method that the CACHE controller can use.

new

Constructor.

The object of the CACHE controller who default and has been treated is returned.

my $cache= $e->model('cache');

SEE ALSO

Egg::Release, Egg::Model::Cache::Base, Egg::Helper::Model::Cache,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.