#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package Metadata::Cache;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::RSApp;
use Common::Util;
use Common::Assert;

use lib '/app/tools/rps/lib';
use RPS::Catalog::DistributionCache;
use RPS::DB::Item::AlbumDistributionReady;

use base 'Common::CronScript';

sub _init {
    my $self = shift;
    my %args = @_;

    $self->{_fresh} = $args{fresh};

    return $self->SUPER::_init(%args);
}

sub _process {
    my $self = shift;
    assert($self);
    my $cache = new RPS::Catalog::DistributionCache;

    RPS::DB::Item::AlbumDistributionReady->DeleteAll() if ( $self->{_fresh} );

    $cache->refreshCache();
}

1;
