Show
Ignore:
Timestamp:
10/07/08 15:48:46 (3 months ago)
Author:
bonnu
Message:

lang/perl/Method-Cached - derivation & syntax correct

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Method-Cached/trunk/lib/Method/Cached/Domain.pm

    r20615 r20895  
    1414 
    1515__PACKAGE__->mk_classaccessor('storage'); 
    16 __PACKAGE__->mk_classaccessor('key_regularizer' => 'LIST'); 
     16__PACKAGE__->mk_classaccessor('key_rule' => 'LIST'); 
    1717 
    1818sub new { 
     
    2020    my %args  = (0 < @_ && ref $_[0] eq 'HASH') ? %{ $_[0] } : @_; 
    2121    my $self  = bless {}, $class; 
    22     my $storage_class   = $args{storage_class}  || croak 'storage_class is necessary'; 
    23     my $storage_args    = $args{storage_args}    || undef; 
    24     my $key_regularizer = $args{key_regularizer} || undef; 
     22    my $storage_class = $args{storage_class} || croak 'storage_class is necessary'; 
     23    my $storage_args  = $args{storage_args}  || undef; 
     24    my $key_rule      = $args{key_rule}      || undef; 
    2525    if (blessed $storage_class) { 
    2626        $self->storage($storage_class); 
     
    3535        $self->storage($storage_class->new(@{ $storage_args || [] })); 
    3636    } 
    37     $self->key_regularizer($key_regularizer) if $key_regularizer; 
     37    $self->key_rule($key_rule) if $key_rule; 
    3838    $self; 
    3939} 
     
    4343    my $registry = Method::Cached::MethodRegistry::refer($name); 
    4444    Method::Cached::KeyRegularizer->regularize( 
    45         $registry->{key_regularizer} || $self->key_regularizer || undef,  
     45        $registry->{key_rule} || $self->key_rule || undef,  
    4646        $name, 
    4747        @args, 
     
    8282  my $domain = Method::Cached::Domain->new( 
    8383      # The supported interface is Cache::Cache and Cache::Memcached.  
    84       storage_class   => 'Cache::Memcached::Fast', 
    85       storage_args    => [ 
     84      storage_class => 'Cache::Memcached::Fast', 
     85      storage_args  => [ 
    8686          { 
    8787              servers         => [qw/ 127.0.0.1:11211 /], 
     
    9191          }, 
    9292      ], 
    93       key_regularizer => undef, 
     93      key_rule      => undef, 
    9494  ); 
    9595