NAME

FWS::V2::Cache - Framework Sites version 2 data caching

VERSION

Version 1.13091122

SYNOPSIS

	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();

DESCRIPTION

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.

METHODS

saveCache

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 );

deleteCache

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' );

flushCache

If anything is in cache currently, after this call it won't be!

#
# Remove all cache keys
#
$fws->flushCache();

flushWebCache

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();

cacheValue

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' );

setPageCache

Used internally to craete combined head css and js cached files so they can be used on the page.

AUTHOR

Nate Lewis, <nlewis at gnetworks.com>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc FWS::V2::Cache

You can also look for information at:

LICENSE AND COPYRIGHT

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.