Edward Kawas > SADI-1.10 > SADI::FileStore

Download:
SADI-1.10.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.12   Source  

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, Mark Wilkinson All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, 
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of the University of British Columbia nor the names of 
      its contributors may be used to endorse or promote products derived from 
      this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

syntax highlighting: