Class::Simple::Cached - cache messages to an object
A sub-class of Class::Simple which caches calls to read the status of an object that are otherwise expensive.
It is up to the caller to maintain the cache if the object comes out of sync with the cache, for example by changing its state.
You can use this class to create a caching layer to an object of any class that works on objects with a get/set model such as:
my $obj = Class::Simple->new();
$oldval = $obj->val();
Creates a Class::Simple::Cached object.
It takes one mandatory parameter: cache, which is either an object which understands clear(), get() and set() calls, such as an CHI object; or is a reference to a hash where the return values are to be stored.
It takes one optional argument: object, which is an object which is taken to be the object to be cached. If not given, an object of the class Class::Simple is instantiated and that is used.
Nigel Horne, <njh at bandsman.co.uk>
<njh at bandsman.co.uk>
Doesn't work with Memoize.
Only works on messages that take no arguments.
Please report any bugs or feature requests to https://github.com/nigelhorne/Class-Simple-Readonly/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
You can also look for information at:
CPAN Testers' Matrix
CPAN Testers Dependencies
Author Nigel Horne: firstname.lastname@example.org Copyright (C) 2019-2021, Nigel Horne
Usage is subject to licence terms. The licence terms of this software are as follows: Personal single user, single computer use: GPL2 All other users (including Commercial, Charity, Educational, Government) must apply in writing for a licence for use from Nigel Horne at the above e-mail.
To install Class::Simple::Cached, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.