<%args>
$key
$expire => 60 * 10
</%args>

<%init>
# Update an inter-process cached datum with information about who last
# accessed this key.  This is useful for indicating who is czaring a
# chunk.
my $cz = $m->cache->get($key);
my $t = time;
if (!defined($cz)) {
    # Nothing in cache, it's just us.
    $cz = {};
}
$cz->{$ENV{REMOTE_USER}} = $t;

# Clean up expired users.
my $texpire = $t - $expire;
foreach my $k (keys %{$cz}) {
    delete $cz->{$k} if $cz->{$k} < $texpire;
}

$m->cache->set($key, $cz);
return $cz;
</%init>
