def replace(self, keys, values, offsets=None, offset=0):
        """Inserts key-value pairs into the cache using the selected caching
        policy algorithm to remove old key-value pairs if it is full.

        Parameters
        ----------
        keys : Tensor
            The keys to insert to the cache.
        values : Tensor
            The values to insert to the cache.
        offsets : Tensor, optional
            The partition offsets of the keys.
        offset : int
            The offset to be added to the keys. Default is 0.
        """
        positions, pointers, offsets = self._policy.replace(
            keys, offsets, offset
        )
        self._cache.replace(positions, values)
        self._policy.writing_completed(pointers, offsets)
Inserts key-value pairs into the cache using the selected caching
        policy algorithm to remove old key-value pairs if it is full.

        Parameters
        ----------
        keys : Tensor
            The keys to insert to the cache.
        values : Tensor
            The values to insert to the cache.
        offsets : Tensor, optional
            The partition offsets of the keys.
        offset : int
            The offset to be added to the keys. Default is 0.
        
python/dgl/graphbolt/impl/cpu_feature_cache.py