NAME

Generic::UI::Cache - A UI description cache module.

SYNOPSIS

 # create new cache
 my $cache = new Generic::UI::Cache(
     -lang    => <file>,
     -ui      => <file>,
     -cfg     => <file>,
     -timeout => 3600,
     -locale  => 'DE',
 ); 
 # find out which data tables exists
 my @tables = $cache->get_tables(); 
 # find out which fields exists in a particular table (order preserved)
 my @fields = $cache->get_fields(-table => 't_users'); 
 # fetch some informations by type (as hashref)
 my $names  = $cache->get_table_localization(-table => 't_users');
 my $types  = $cache->get_table_types(-table => 't_users'); 
 # fetch all available informations about a table (order preserved) (as hashref)
 my $all    = $cache->get_table_info(-table => 't_users'); 
 # fetch specific informations about a particular field (as hashref)
 my $name = $cache->get_field_localization(-table => 't_users', -field => 'd_pass');
 my $type = $cache->get_field_type(-table => 't_users', -field => 'd_pass'); 
 # fetch all available informations about a particular field (as hashref)
 my $all = $cache->get_field_info(-table => 't_users', -field => 'd_pass'); 
 # find out which locale is currently in use
 my $cur_lc = $cache->get_current_locale(); 
 # find out the current configuration
 my $config = $cache->get_cfg(); 
 # find messages for current locale for a particular table
 my %messages = get_messages(-table => 't_users'); 

DESCRIPTION

This is an internal module and will be used by apache modules for caching purposes. You normally should not need it directly.

This module caches the whole database description of a database. It also caches the locales and templates.

Since it is running under mod_perl, the information it contains is always available as long as the current apache child process it runs under is working.

You can set a timeout value, if the timeout is being reached, all the informations will be re-gathered.

METHODS

new();

Initialize the Cache.

Parameters:

-timeout

Specifies the time in seconds to keep the cache in RAM. If the time is over, then the module will reload the whole cache.

If the -timeout parameter is not set or set to 0, then no caching will be done. Not recommended.

-locale

Specifies the locale setting to be used. Corresponding entries in the locale table must exist. See GenericUiUi for more details on the required database structure.

-lang

Must be set to a filename containing Config::General-valid configuration about the locale definitions per locale and table.

-ui

Must be set to a filename containing Config::General-valid configuration about the table definitions.

cfg

Must be set to a filename containing Config::General-valid configuration about the database connection informations.