NAME
Make::Cache - Caching of object and test run information
SYNOPSIS
my $oc = Make::Cache->new (...)
$oc->write
if (my $hit = $oc->find_hit) {
$hit->restore;
}
$oc->dump
DESCRIPTION
Make::Cache is used to accelerate the generation of makefile targets. When a target is to be created, it is looked up in the cache. On a miss, the hash of the source files, and all the generated targets are stored.
Next time the target is needed, the cache will hit, and the target files may be retrieved from the cache instead of being regenerated.
The Make::Cache class is generally used as a base class for more specific classes.
LOCAL TO GLOBAL
Make::Cache converts local filenames to global filenames. This gets around the problem of compile lines similar to
gcc /user/a/home_dir/foo.c
resulting in cache misses, because someone else compiled the exact same source in a different directory
gcc /user/b/home_dir/foo.c
To avoid this, all filenames are converted to global format, by using a file_env list passed in the new constructor. By default, this converts the current working directory (cwd) to $CWD. Using the examples above, the gcc command line would be hashed as if the user typed:
gcc $$CWD$$/foo.c
Which is identical for both users, and thus will result in cache hits.
FUNCTIONS
- new
-
Create a new Cache::Hash object. Named parameters may be specified:
- clean_delay
-
Number of seconds a object must be in age before clean() may delete it. Default is one day (24*60*60).
- file_env
-
List of environment variables for substitution, see LOCAL TO GLOBAL section.
- read
-
Defaults true to enable finding hits in the cache.
- write
-
Defaults true to enable writing updates to the cache.
- clear_hash_cache
-
If a source file changes, this function must be called to clear out a temporary internal cache.
- clean
-
Clean the cache. See the clean_delay variable.
- cmds_gbl
-
Return list of commands, relative to all users. This is used in hashing; see LOCAL TO GLOBAL section.
- cmds_lcl
-
Return list of commands, relative to the local user, that should be executed. With parameter, add the specified command.
- deps_gbl
-
Return list of source dependency filenames, relative to all users. This is used in hashing; see LOCAL TO GLOBAL section.
- deps_lcl
-
Return list of source dependency filenames, relative to the local user, that should be executed. With parameter, add the specified filename.
-
For debugging, dump the current contents of the compile cache.
- flags_gbl
-
Return list of compile flags, relative to all users. This is used in hashing; see LOCAL TO GLOBAL section.
- flags_lcl
-
Return list of compile flags, relative to the local user, that should be executed. With parameter, add the specified flag.
- global_filename
-
Given a local filename, return the filename in global format. See LOCAL TO GLOBAL section.
- local_filename
-
Given a global filename, return the filename in local format. See LOCAL TO GLOBAL section.
- nodup
-
Given a input list, return the list with any duplicates removed.
- tgts_gbl
-
Return list of target filenames, relative to all users. This is used in hashing; see LOCAL TO GLOBAL section.
- tgts_lcl
-
Return list of target filenames, relative to the local user, that should be executed. With parameter, add the specified filename.
- tgts_missing
-
Return the filename of any local targets that are not currently on disk. Return undef if all targets exist.
- tgts_unlink
-
Remove all local target files.
- write
-
Write the cache digest.
- restore (object_from_find_hit)
-
Given a object returned from find_hit, restore any target files to the local compile area.
DISTRIBUTION
The latest version is available from CPAN and from http://www.veripool.com/.
Copyright 2000-2004 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License or the Perl Artistic License.
AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>
SEE ALSO
objcache, Make::Cache::Runtime, Make::Cache::Hash, Make::Cache::Obj, Make::Cache::Gcc
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 605:
Expected text after =item, not a bullet