1Code::TidyAll::CacheModUesle(r3)Contributed Perl DocumenCtoadtei:o:nTidyAll::CacheModel(3)
2
3
4

NAME

6       Code::TidyAll::CacheModel - Caching model for Code::TidyAll
7

VERSION

9       version 0.83
10

SYNOPSIS

12         my $cache_model = Cody::TidyAll::CacheModel->new(
13             cache_engine => Code::TidyAll::Cache->new(...),
14             path         => '/path/to/file/to/cache',
15         );
16
17         # check cache
18         print 'Yes!' if $cache_model->is_cached;
19
20         # update cache
21         $cache_model->clear_file_contents;
22         $cache_model->update;
23
24         # update the cache when you know the file contents
25         $cache_model->file_contents($new_content);
26         $cache_model->update;
27
28         # force removal from cache
29         $cache_model->remove;
30

DESCRIPTION

32       A cache model for Code::TidyAll. Different subclasses can employ
33       different caching techniques.
34
35       The basic model implemented here is simple; It stores a hash key of the
36       file contents keyed by a hash key of the file's path.
37

METHODS

39       This class has the following methods:
40
41   Code::TidyAll::CacheModel->new(%params)
42       The constructor accepts the following attributes:
43
44       •   full_path
45
46           The full path to the cache file on disk. This is required.
47
48       •   path
49
50           The local path to the file (i.e. what the cache system will
51           consider the canonical name of the file).
52
53       •   cache_engine
54
55           A "Code::TidyAll::Cache" compatible instance. This can be omitted
56           if no caching is actually being done.
57
58       •   base_sig
59
60           A base signature. This defaults to an empty string.
61
62       •   file_contents
63
64           The contents of the file being cached. This can be omitted, in
65           which case it will be loaded as needed.
66
67       •   is_cached
68
69           A boolean indicating if this file is cached. By default this is
70           computed by checking that the cache key and cache value match what
71           is in the cache.
72
73   $model->full_path
74       The value passed to the constructor.
75
76   $model->path
77       The value passed to the constructor.
78
79   $model->cache_engine
80       The value passed to the constructor.
81
82   $model->base_sig
83       The value passed to the constructor or the default value, an empty
84       string.
85
86   $model->file_contents
87       The file contents, which will be loaded from the file system if needed.
88
89   $model->is_cached
90       A boolean indicating whether the path is currently in the cache.
91
92   $model->cache_key
93       The computed cache key for the file.
94
95   $model->cache_value
96       The computed cache value for the file.
97
98   $model->update
99       Updates the cache.
100
101   $model->remove
102       Attempts to remove the value from the cache.
103

SUPPORT

105       Bugs may be submitted at
106       <https://github.com/houseabsolute/perl-code-tidyall/issues>.
107

SOURCE

109       The source code repository for Code-TidyAll can be found at
110       <https://github.com/houseabsolute/perl-code-tidyall>.
111

AUTHORS

113       •   Jonathan Swartz <swartz@pobox.com>
114
115       •   Dave Rolsky <autarch@urth.org>
116
118       This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
119
120       This is free software; you can redistribute it and/or modify it under
121       the same terms as the Perl 5 programming language system itself.
122
123       The full text of the license can be found in the LICENSE file included
124       with this distribution.
125
126
127
128perl v5.36.0                      2023-01-20      Code::TidyAll::CacheModel(3)
Impressum