| 1 | package Search::Sitemap::URLStore::Memory; | ||
| 2 | $Search::Sitemap::URLStore::Memory::VERSION = '2.13_01'; | ||
| 3 | use 5.008003; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | our $AUTHORITY = 'cpan:JASONK'; | ||
| 7 | use Moose; | ||
| 8 | extends 'Search::Sitemap::URLStore'; | ||
| 9 | use MooseX::Types::Moose qw( HashRef ); | ||
| 10 | use Class::Trigger; | ||
| 11 | use namespace::clean -except => 'meta'; | ||
| 12 | |||
| 13 | has 'storage' => ( is => 'ro', isa => HashRef, default => sub { {} } ); | ||
| 14 | |||
| 15 | sub get { | ||
| 16 | my ( $self, $url ) = @_; | ||
| 17 | return $self->storage->{ $url }; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub put { | ||
| 21 | my $self = shift; | ||
| 22 | |||
| 23 | $self->storage->{ $_->loc } = $_ for @_; | ||
| 24 | |||
| 25 | return 1; | ||
| 26 | } | ||
| 27 | |||
| 28 | sub all { return values %{ shift->storage } } | ||
| 29 | |||
| 30 | __PACKAGE__->meta->make_immutable; | ||
| 31 | 1; | ||
| 32 | __END__ |