Created
July 4, 2016 01:00
-
-
Save pen/3ee10aad79ee2701cd7d8f6189e527f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub get_data | |
{ | |
my ($self, $key) = @_; | |
$data = $self->get($key); | |
$flag = $self->get("$key\::flag"); | |
unless ($flag && $data) { | |
$self->set("$key\::flag", 1, $self->expire - $self->delta); | |
...; # do task | |
$self->set($key, $data, $self->expire); | |
} | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment