Code::TidyAll::CacheModel(3pm)

Code::TidyAll::CacheModel3pm

Caching model for code::tidyall

Usage

  my $cache_model = Cody::TidyAll::CacheModel->new(
      cache_engine => Code::TidyAll::Cache->new(...),
      path         => '/path/to/file/to/cache',
  );
  # check cache
  print 'Yes!' 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;

Version

version 0.84

Overview

A cache model for Code::TidyAll. Different subclasses can employ different caching techniques.

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.

Methods

This class has the following methods:

Code::TidyAll::CacheModel->new(%params)

The constructor accepts the following attributes:

•

full_path

The full path to the cache file on disk. This is required.

•

path

The local path to the file (i.e. what the cache system will consider the canonical name of the file).

•

cache_engine

A "Code::TidyAll::Cache" compatible instance. This can be omitted if no caching is actually being done.

•

base_sig

A base signature. This defaults to an empty string.

•

file_contents

The contents of the file being cached. This can be omitted, in which case it will be loaded as needed.

•

is_cached

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.

$model->full_path

The value passed to the constructor.

$model->path

The value passed to the constructor.

$model->cache_engine

The value passed to the constructor.

$model->base_sig

The value passed to the constructor or the default value, an empty string.

$model->file_contents

The file contents, which will be loaded from the file system if needed.

$model->is_cached

A boolean indicating whether the path is currently in the cache.

$model->cache_key

The computed cache key for the file.

$model->cache_value

The computed cache value for the file.

$model->update

Updates the cache.

$model->remove

Attempts to remove the value from the cache.

Support

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

Source

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

Releases

5 releases since Debian 9 (Stretch); the text changed 4 times.

  1. 9
  2. 10
  3. 11
  4. 12
  5. 13

Authors

•

Jonathan Swartz <[email protected]>

•

Dave Rolsky <[email protected]>

From libcode-tidyall-perl 0.84~ds-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.