.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Code::TidyAll::CacheModel 3pm" .TH Code::TidyAll::CacheModel 3pm "2022-12-31" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Code::TidyAll::CacheModel \- Caching model for Code::TidyAll .SH "VERSION" .IX Header "VERSION" version 0.83 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& my $cache_model = Cody::TidyAll::CacheModel\->new( \& cache_engine => Code::TidyAll::Cache\->new(...), \& path => \*(Aq/path/to/file/to/cache\*(Aq, \& ); \& \& # check cache \& print \*(AqYes!\*(Aq if $cache_model\->is_cached; \& \& # update cache \& $cache_model\->clear_file_contents; \& $cache_model\->update; \& \& # update the cache when you know the file contents \& $cache_model\->file_contents($new_content); \& $cache_model\->update; \& \& # force removal from cache \& $cache_model\->remove; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A cache model for Code::TidyAll. Different subclasses can employ different caching techniques. .PP The basic model implemented here is simple; It stores a hash key of the file contents keyed by a hash key of the file's path. .SH "METHODS" .IX Header "METHODS" This class has the following methods: .SS "Code::TidyAll::CacheModel\->new(%params)" .IX Subsection "Code::TidyAll::CacheModel->new(%params)" The constructor accepts the following attributes: .IP "\(bu" 4 full_path .Sp The full path to the cache file on disk. This is required. .IP "\(bu" 4 path .Sp The local path to the file (i.e. what the cache system will consider the canonical name of the file). .IP "\(bu" 4 cache_engine .Sp A \f(CW\*(C`Code::TidyAll::Cache\*(C'\fR compatible instance. This can be omitted if no caching is actually being done. .IP "\(bu" 4 base_sig .Sp A base signature. This defaults to an empty string. .IP "\(bu" 4 file_contents .Sp The contents of the file being cached. This can be omitted, in which case it will be loaded as needed. .IP "\(bu" 4 is_cached .Sp A boolean indicating if this file is cached. By default this is computed by checking that the cache key and cache value match what is in the cache. .ie n .SS "$model\->full_path" .el .SS "\f(CW$model\fP\->full_path" .IX Subsection "$model->full_path" The value passed to the constructor. .ie n .SS "$model\->path" .el .SS "\f(CW$model\fP\->path" .IX Subsection "$model->path" The value passed to the constructor. .ie n .SS "$model\->cache_engine" .el .SS "\f(CW$model\fP\->cache_engine" .IX Subsection "$model->cache_engine" The value passed to the constructor. .ie n .SS "$model\->base_sig" .el .SS "\f(CW$model\fP\->base_sig" .IX Subsection "$model->base_sig" The value passed to the constructor or the default value, an empty string. .ie n .SS "$model\->file_contents" .el .SS "\f(CW$model\fP\->file_contents" .IX Subsection "$model->file_contents" The file contents, which will be loaded from the file system if needed. .ie n .SS "$model\->is_cached" .el .SS "\f(CW$model\fP\->is_cached" .IX Subsection "$model->is_cached" A boolean indicating whether the path is currently in the cache. .ie n .SS "$model\->cache_key" .el .SS "\f(CW$model\fP\->cache_key" .IX Subsection "$model->cache_key" The computed cache key for the file. .ie n .SS "$model\->cache_value" .el .SS "\f(CW$model\fP\->cache_value" .IX Subsection "$model->cache_value" The computed cache value for the file. .ie n .SS "$model\->update" .el .SS "\f(CW$model\fP\->update" .IX Subsection "$model->update" Updates the cache. .ie n .SS "$model\->remove" .el .SS "\f(CW$model\fP\->remove" .IX Subsection "$model->remove" Attempts to remove the value from the cache. .SH "SUPPORT" .IX Header "SUPPORT" Bugs may be submitted at . .SH "SOURCE" .IX Header "SOURCE" The source code repository for Code-TidyAll can be found at . .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Jonathan Swartz .IP "\(bu" 4 Dave Rolsky .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011 \- 2022 by Jonathan Swartz. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. .PP The full text of the license can be found in the \&\fI\s-1LICENSE\s0\fR file included with this distribution.