Before update code to be used when expiration happens: <pre> has temperature => ( traits => ['Cache'], is => 'rw', isa => 'Int', builder => _get_temperature, required => 1, expiration_time => 10, before_update => sub { my ($self, $expired) = @_; $self->save_or_discard($expired) } ); </pre>