FWS::V2::Cache - Framework Sites version 2 data caching
Version 1.13091122
use FWS::V2; my $fws = FWS::V2->new(); my $cacheData = $fws->cacheValue( 'someData' ) || &{ sub { my $value = 'This is a testineeg!'; # # do something... # return $fws->saveCache( key => 'someData', expire => 1, value => $value ); } }; print $cacheData; $fws->deleteCache( key => 'someData' ); $fws->flushCache();
FWS version 2 cache methods are used as a portable non-environment specific cache library to the FWS data model. For maximum compatibility it uses the file FWSCache directory under the sites fileSecurePath directory to store its data and is compatible with NFS or other distributed file systems.
Save data to cache passing they key, value and expire (in minutes). The return will be the string passed as value.
# # Save my data to cache and hang on to it for 5 minutes before getting a new a new one # but return the current one if my 5 minutes isn't up # $someValue = $fws->saveCache( key => 'someData', value => $someValue, expire => 5 );
Remove a key from cache. For optmization, this does not look up the key, only blindly remove it.
# # We no longer need somData lets get rid of it # $fws->deleteCache( key => 'someData' );
If anything is in cache currently, after this call it won't be!
# # Remove all cache keys # $fws->flushCache();
Removes all files located in your web cache. These are the files that are your combined js, and css files created on the fly when pages are rendered. When pages are loaded after this is ran, it will start to repopulate the cache with newly created web cache files.
# # Remove all web cache files # $fws->flushWebCache();
Return the cache value. If the cache value does not exist, it will return blank in same way that formValue, siteValue and userValue.
# # will return the cache value. This or a blank string if it is not set, or blank # print $fws->caheValue( 'someData' );
Used internally to craete combined head css and js cached files so they can be used on the page.
Nate Lewis, <nlewis at gnetworks.com>
<nlewis at gnetworks.com>
Please report any bugs or feature requests to bug-fws-v2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FWS-V2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-fws-v2 at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc FWS::V2::Cache
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=FWS-V2
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/FWS-V2
CPAN Ratings
http://cpanratings.perl.org/d/FWS-V2
Search CPAN
http://search.cpan.org/dist/FWS-V2/
Copyright 2013 Nate Lewis.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install FWS::V2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FWS::V2
CPAN shell
perl -MCPAN -e shell install FWS::V2
For more information on module installation, please visit the detailed CPAN module installation guide.