NAME
SADI::FileStore - A module for (add|get|delet)ing persistent data
SYNOPSIS
use SADI::FileStore;
# create a new blank SADI FileStore object
my $data = SADI::FileStore->new ();
# create a new primed SADI File store object
$data = SADI::FileStore->new (
ServiceName => "HelloWorldService",
);
# get the service name
my $name = $data->ServiceName;
# set the service name
$data->ServiceName($name);
# create a unique id
my $uid = $data->generate_uid();
# store a persistent file
$data->add($uid,"my value");
# get the persistent file
$data->get($uid);
# remove the persistent file
$data->remove($uid);
DESCRIPTION
A module for creating persistent files (for use with asynchronous services)
ACCESSIBLE ATTRIBUTES
Details are in SADI::Base. Here just a list of them (additionally to the attributes from the parent classes)
- ServiceName
-
The name of the service that this FileStore will operate on
SUBROUTINES
add
# use this method to add persistent data to the store.
# Given a unique identifier, $uid, and the data, $data,
# this sub will store the information for you.
# Throws an exception if there are problems writing to disk.
#
# You can provide any identifier (but make it unique or else
# existing data will be over-written). If you want to generate
# one automatically, use C<generate_uid>.
get
# use this method to get persistent data from the store.
# Given a unique identifier, $uid, this sub will retrieve
# the information for you.
# Throws an exception if there are problems retrieving the data
# from the disk.
remove
# use this method to remove persistent data from the store.
# Given a unique identifier, $uid, this sub will remove
# the persistent data from the store.
# Throws an exception if there are problems removing the data
# from the store.
#
# Also, if the service that created this store no longer has
# data in the store, then the service directory is removed so
# that no files are left over.
generate_uid
# use this method to generate a unique identifier for use with C<add>.
# Given an optional length for our unique identifier (defaults to 24),
# a unique identifier is generated.
# using the default length, you have a 1 in 24^6760 chance of generating
# a duplicate uid. All uids generated are a combo of letters and numbers.
clean_store
# use this method to clean the file store.
# Given an optional age in days of files to clean (defaults to 2.00),
# the file store is checked for files that meet this critia and removed.
AUTHORS, COPYRIGHT, DISCLAIMER
Edward Kawas (edward.kawas [at] gmail [dot] com)
Copyright (c) 2009 Edward Kawas. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This software is provided "as is" without warranty of any kind.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 144:
=cut found outside a pod block. Skipping to next block.