Hub::Data::FileCache - Hub::Data::FileCache documentation


hub-standard documentation  | view source Contained in the hub-standard distribution.

Index


NAME

Top

Hub::Data::FileCache -

SYNOPSIS

Top

DESCRIPTION

Top

PUBLIC METHODS

Top

fattach

Attach an instance of a class to a file.





 Usage: fattach $filename, $class




$class must implement the method reload

Returns a hash of:



  lastread    # mod time last time we read it
  filename    # name
  lines       # ARRAY of lines in the file
  handlers    # HASH of attached classes




The instance is a singleton.

fhandler

Get the file handler for a given file


 Usage: fhandler $filename, $classname
 Usage: fhandler $filename
In its first form, we will return the handler for the given class name.

In its second form, we will return all handlers for the given file.

finstance

Get the cache instance for a specific file


 Usage: finstance - $filename




frefresh

Signal handlers to reparse


 Usage: frefresh [$filename], [options]




options:



  -force=>1         Force re-reading all
  -force_dirs=>1    Force re-reading of directories




Without a $filename, all file instances are checked for disk modifications.

If the file has been modified, re-read the file and tell all your handlers to reparse themselves via the reload method.

With a $filename, only handlers for the specific filename are signaled to reparse.

fread

Modify the provided instance to reflect what is on disk.





 Usage: fread $instance




$instance must be the special hash returned by finstance If all handling classes implement the delay_reading function, and they all return a true value, we will not read file.

AUTHOR

Top

Ryan Gies (ryangies@livesite.net)

COPYRIGHT

Top

UPDATED

Top

08/02/2007


hub-standard documentation  | view source Contained in the hub-standard distribution.