Beam::Make::Cache - Store information about recipes performed
version 0.003
my $cache = Beam::Make::Cache->new; # Update the cache and track what the content should be $cache->set( 'recipe', 'content hash' ); # Set the last modified time to a specific time by passing # a Time::Piece object $cache->set( 'recipe', 'content hash', $timestamp ); # Get a Time::Piece object if the content hashes match # Otherwise returns 0 my $time = $cache->last_modified( 'recipe', 'content hash' );
This class provides an API to access timestamps and content hashes to validate recipes and determine which recipes are out-of-date and should be re-run.
The cache file cannot be accessed by more than one process. This limitation may be fixed in the future. Other cache modules that use distributed databases may also be created in the future.
The path to a file to use for the cache. Defaults to .Beamfile.cache in the current directory.
.Beamfile.cache
$cache->set( $name, $hash, $time ); # Update modified time to now $cache->set( $name, $hash );
Set an entry in the cache. $name is the recipe name. $hash is an identifier for the content (usually a base64 SHA-1 hash from Digest::SHA). $time is a Time::Piece object to save as the last modified time. If $time is not provided, defaults to now.
$name
$hash
$time
my $time = $cache->last_modified( $name, $hash );
Get the last modified timestamp (as a Time::Piece object) for the given recipe $name. If the $hash does not match what was given to "set", or if the recipe has never been made, returns 0.
0
Beam::Make
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2020 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Beam::Make, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beam::Make
CPAN shell
perl -MCPAN -e shell install Beam::Make
For more information on module installation, please visit the detailed CPAN module installation guide.