public function serialize()
    {
        if (is_null($this->bin)) {
            return '';
        }

        $length_prefixed_bin = strlen($this->bin) . ':' . $this->bin;

        if (is_null($this->key)) {
            return $length_prefixed_bin . ':';
        }
        return $length_prefixed_bin . ':' . $this->key;
    }