Search::Sitemap::URLStore::Memory - Search::Sitemap in-memory URL store


Search-Sitemap documentation Contained in the Search-Sitemap distribution.

Index


Code Index:

NAME

Top

Search::Sitemap::URLStore::Memory - Search::Sitemap in-memory URL store

METHODS

Top

put( @urls )

Add one or more Search::Sitemap::URL objects to the URL store.

get( $url )

Retrieve a Search::Sitemap::URL object from the URL store.

all

Return all the Search::Sitemap::URL objects from the URL store.

SEE ALSO

Top

Search::Sitemap

Search::Sitemap::URLStore::Memory

AUTHOR

Top

Jason Kohles, <email@jasonkohles.com>

COPYRIGHT AND LICENSE

Top


Search-Sitemap documentation Contained in the Search-Sitemap distribution.

package Search::Sitemap::URLStore::Memory;
use strict; use warnings;
our $VERSION = '2.13';
our $AUTHORITY = 'cpan:JASONK';
use Moose;
extends 'Search::Sitemap::URLStore';
use MooseX::Types::Moose qw( HashRef );
use Class::Trigger;
use namespace::clean -except => 'meta';

has 'storage'   => ( is => 'ro', isa => HashRef, default => sub { {} } );

sub get {
    my ( $self, $url ) = @_;
    return $self->storage->{ $url };
}

sub put {
    my $self = shift;

    $self->storage->{ $_->loc } = $_ for @_;

    return 1;
}

sub all { return values %{ shift->storage } }

__PACKAGE__->meta->make_immutable;
1;
__END__