Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nigelhorne/class-simple-cached
Cache messages to an object
https://github.com/nigelhorne/class-simple-cached
cpan optimization perl
Last synced: 29 days ago
JSON representation
Cache messages to an object
- Host: GitHub
- URL: https://github.com/nigelhorne/class-simple-cached
- Owner: nigelhorne
- License: gpl-2.0
- Created: 2019-09-17T22:22:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-15T18:38:38.000Z (3 months ago)
- Last Synced: 2024-09-15T19:55:30.099Z (3 months ago)
- Topics: cpan, optimization, perl
- Language: Perl
- Homepage: https://metacpan.org/pod/Class::Simple::Cached
- Size: 69.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![Kwalitee](https://cpants.cpanauthors.org/dist/Class-Simple-Cached.png)](http://cpants.cpanauthors.org/dist/Class-Simple-Cached)
[![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Cache+messages+to+an+object+#perl&url=https://github.com/nigelhorne/class-simple-cached&via=nigelhorne)# NAME
Class::Simple::Cached - cache messages to an object
# VERSION
Version 0.05
# SYNOPSIS
A sub-class of [Class::Simple](https://metacpan.org/pod/Class%3A%3ASimple) 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:use Class::Simple;
my $obj = Class::Simple->new();
$obj->val('foo');
my $oldval = $obj->val();# SUBROUTINES/METHODS
## new
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](https://metacpan.org/pod/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](https://metacpan.org/pod/Class%3A%3ASimple) is instantiated
and that is used.## can
Returns if the embedded object can handle a message
## isa
Returns if the embedded object is the given type of object
# AUTHOR
Nigel Horne, ``
# BUGS
Doesn't work with [Memoize](https://metacpan.org/pod/Memoize).
Only works on messages that take no arguments.
For that, use [Class::Simple::Readonly::Cached](https://metacpan.org/pod/Class%3A%3ASimple%3A%3AReadonly%3A%3ACached).Please report any bugs or feature requests to [https://github.com/nigelhorne/Class-Simple-Readonly/issues](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.# SEE ALSO
[Class::Simple](https://metacpan.org/pod/Class%3A%3ASimple), [CHI](https://metacpan.org/pod/CHI)
# SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Class::Simple::Cached
You can also look for information at:
- MetaCPAN
[https://metacpan.org/release/Class-Simple-Cached](https://metacpan.org/release/Class-Simple-Cached)
- Source Repository
[https://github.com/nigelhorne/Class-Simple-Readonly-Cached](https://github.com/nigelhorne/Class-Simple-Readonly-Cached)
- CPANTS
[http://cpants.cpanauthors.org/dist/Class-Simple-Cached](http://cpants.cpanauthors.org/dist/Class-Simple-Cached)
- CPAN Testers' Matrix
[http://matrix.cpantesters.org/?dist=Class-Simple-Cached](http://matrix.cpantesters.org/?dist=Class-Simple-Cached)
- CPAN Testers Dependencies
[http://deps.cpantesters.org/?module=Class::Simple::Cached](http://deps.cpantesters.org/?module=Class::Simple::Cached)
# LICENCE AND COPYRIGHT
Author Nigel Horne: `[email protected]`
Copyright (C) 2019-2024, Nigel HorneUsage 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.