X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Foption_Common.pm;h=968dcdf798ea68901db5906b37fa4f01d6d10518;hb=a98f19c50a42530058ffdf052f6e6352aa1e5572;hp=182356b3bf1b1daa9556f82cfcdc04a366dcf922;hpb=2413a3d43808ea6567bf25215d810bf102c498fd;p=freeside.git diff --git a/FS/FS/option_Common.pm b/FS/FS/option_Common.pm index 182356b3b..968dcdf79 100644 --- a/FS/FS/option_Common.pm +++ b/FS/FS/option_Common.pm @@ -323,6 +323,19 @@ sub option { $obj ? $obj->$valuecol() : ''; } +=item option_cacheable OPTIONNAME + +Same as the option method, but may cache and return a cached value. +Good for use within loops; otherwise, probably avoid. + +=cut + +sub option_cacheable { + my( $self, $name ) = @_; + return $self->{option_cache}{$name} if exists $self->{option_cache}{$name}; + $self->{option_cache}{$name} = $self->option($name,1); +} + sub option_table { my $self = shift;