Scroll to navigation

Code::TidyAll::CacheModel(3pm) User Contributed Perl Documentation Code::TidyAll::CacheModel(3pm)


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


version 0.82


  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
  # update the cache when you know the file contents
  # force removal from cache


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.


This class has the following methods:


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.


The value passed to the constructor.


The value passed to the constructor.


The value passed to the constructor.


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


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


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


The computed cache key for the file.


The computed cache value for the file.


Updates the cache.


Attempts to remove the value from the cache.


Bugs may be submitted at <>.


The source code repository for Code-TidyAll can be found at <>.


  • Jonathan Swartz <>
  • Dave Rolsky <>


This software is copyright (c) 2011 - 2022 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

The full text of the license can be found in the LICENSE file included with this distribution.

2022-04-16 perl v5.34.0