Changeset 1026
- Timestamp:
- 06/30/06 10:59:52
- Files:
-
- trunk/plagger/lib/Plagger.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Cache.pm (modified) (3 diffs)
- trunk/plagger/t/core/cache.t (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger.pm
r1024 r1026 151 151 my $dir = $base eq 'config' ? ".plagger" : ".plagger-$base"; 152 152 153 $self->{conf}->{cache} ||= { 154 base => File::Spec->catfile($ENV{HOME}, $dir), 155 }; 153 # cache is auto-vivified but that's okay 154 $self->{conf}->{cache}->{base} ||= File::Spec->catfile($ENV{HOME}, $dir); 156 155 157 156 $self->cache( Plagger::Cache->new($self->{conf}->{cache}) ); … … 409 408 } 410 409 411 412 410 1; 413 411 __END__ trunk/plagger/lib/Plagger/Cache.pm
r718 r1026 15 15 $conf->{params} ||= { 16 16 cache_root => File::Spec->catfile($conf->{base}, 'cache'), 17 default_expires_in => $conf->{expires} || 'never', 17 18 }; 18 19 … … 29 30 base => $conf->{base}, 30 31 cache => $conf->{class}->new($conf->{params}), 32 to_purge => $conf->{expires} ? 1 : 0, 31 33 }, $class; 32 34 } … … 103 105 } 104 106 107 sub DESTROY { 108 my $self = shift; 109 $self->{cache}->purge() if $self->{to_purge}; 110 } 111 105 112 1;
