cacheData
- Class to hold and work with a piece of data for the cacheHandler-class.
use cacheData;
# instantiate the class
my $d=cacheData->new();
# set the data of the instance
my %h;
$h{whatever}="somedata";
$h{thisandthat}="someotherdata";
$d->set(\%h);
# get the data of the instance
my $data=$d->get();
A class to work with a piece of data in the cacheHandler-class. It support setting and getting the data, including adding an identifier for the data.
Constructor. Instantiate a cacheData-class.
Input accepts the following parameters:
id Sets the unique ID of the cacheData-instance. The ID has no meaning to the class and should be used by the caller to uniquly identify the piece of data that the instance contains. SCALAR. Optional. If not specified will default to a random string of 32 characters.
data Sets the piece of data that the cacheData-instance stores. SCALAR or a variable-reference. Optional. If not set, it can be set later by calling the set()-method on the instance.
Returns an instance of the class upon success.
Sets the piece of data that the instance contains.
It only accepts one parameter which is the data to store. The data can either be a SCALAR or a variable-reference.
Returns 1.
Gets the piece of data that the instance contains.
If the piece of data returned was a reference to a SCALAR, the SCALAR itself is returned. If the data is anything else, the method just returns the piece of data.
Returns the unique ID of the instance.
No parameters accepted.
The returned ID is a SCALAR.