X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Foption_Common.pm;h=968dcdf798ea68901db5906b37fa4f01d6d10518;hp=182356b3bf1b1daa9556f82cfcdc04a366dcf922;hb=5b73387992a96f7b80e40b5ecb2fedabd8a78d6b;hpb=3e05cfa324d281922e62f718ff0583d36f75f0b9 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;