/** * Encode value and expiry for storage */ function encode($value, $expiry) { # Convert to absolute time $expiry = BagOStuff::convertExpiry($expiry); return sprintf('%010u', intval($expiry)) . ' ' . serialize($value); }