1 package FS::SearchCache;
5 #use Carp qw(carp cluck croak confess);
11 FS::SearchCache - cache
27 my $class = ref($proto) || $proto;
28 my( $table, $key ) = @_;
29 warn "table $table\n" if $DEBUG > 1;
30 warn "key $key\n" if $DEBUG > 1;
31 my $self = { 'table' => $table,
36 bless ($self, $class);
45 sub table { my $self = shift; $self->{table}; }
51 sub key { my $self = shift; $self->{key}; }
57 sub cache { my $self = shift; $self->{cache}; }
68 if ( exists $self->{subcache}->{$col}->{$keyval} ) {
69 warn "returning existing subcache for $keyval ($col)".
70 "$self->{subcache}->{$col}->{$keyval}\n" if $DEBUG;
71 return $self->{subcache}->{$col}->{$keyval};
73 #my $tablekey = @_ ? shift : $col;
75 my $subcache = ref($self)->new( $table, $tablekey );
76 $self->{subcache}->{$col}->{$keyval} = $subcache;
77 warn "creating new subcache $table $tablekey: $subcache\n" if $DEBUG;
90 L<FS::Record>, L<FS::cust_main>