MOBY::RDF::Ontologies::Cache::CacheUtils - Utility module that aids in caching
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"; }
This module aids in the creation and maintainence of cache directories
Edward Kawas (edward.kawas [at] gmail [dot] com)
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).
Return true if a local cache for the given registry exists (or probably exists). An argument is a an endpoint of a registry.
Return the cache dir
Creates the cache directories needed for generating datatypes and services.
Throws an exception if there are problems creating the directories.
Gets the cache directories used for a specific cache as a hash.