sub getImportantValue { my $subscriber = shift; #subscription length in seconds my $subscriptionLength = $ENV{SUBSCRIPTION_LENGTH} ; my $stored = $memd->get($subscriber); if (defined($stored)) { return $stored; } #we don't have a value #maybe it's their first time? # or maybe the old value expired #get value from remote system my $value = getValueFromOtherPlace($stuff, $needed, $for, $query); $memd->set($subscriber, $value, $subscriptionLength); return $value; }