NAME

MOBY::RDF::Ontologies::Cache::CacheUtils - Utility module that aids in caching

SYNOPSIS

use MOBY::RDF::Ontologies::Cache::CacheUtils;
my $cachedir = "C:/tmp/";
my $url      = "http://moby.ucalgary.ca/moby/MOBY-Central.pl";
my $uri      = "http://moby.ucalgary.ca/MOBY/Central";

my $x = MOBY::RDF::Ontologies::Cache::CacheUtils->new(

	endpoint  => $url,
	namespace => $uri,
	cache     => $cachedir,

);

# create the cache directory
$x->create_cache_dirs;

# check if the cache exists
print "Cache exists!\n" if $x->cache_exists();
print "Cache doesnt exist!\n" unless $x->cache_exists();

# get the cache dir
print "The cache dir is: " . $x->cachedir . "\n";

# get the exact location of all cache dirs
my $dirs = $x->get_cache_dirs();
while ( ( $key, $value ) = each( %{$dirs} ) ) {    
	print "$key is stored in $value\n";
}

DESCRIPTION

This module aids in the creation and maintainence of cache directories

AUTHORS

Edward Kawas (edward.kawas [at] gmail [dot] com)

SUBROUTINES

new

Instantiate a CacheUtils object.

Parameters: * A Hash with keys: -> endpoint => the BioMOBY registry endpoint to use <required> -> namespace => the BioMOBY registry namespace to use <required> -> cache => the directory to store the cache <required>

If endpoint or cache are not specified, then new fails (dies).

cache_exists

Return true if a local cache for the given registry exists (or probably exists). An argument is a an endpoint of a registry.

cachedir

Return the cache dir

create_cache_dirs

Creates the cache directories needed for generating datatypes and services.

Throws an exception if there are problems creating the directories.

get_cache_dirs

Gets the cache directories used for a specific cache as a hash.