def cache(self, store=None, **kwargs):
        if store is not None and hasattr(store, 'shape'):
            self.store(store)
            return from_array(store, chunks=self.chunks)
        if store is None:
            try:
                from chest import Chest
                store = Chest()
            except ImportError:
                if self.nbytes <= 1e9:
                    store = dict()
                else:
                    raise ValueError("No out-of-core storage found."
                        "Either:\n"
                        "1. Install ``chest``, an out-of-core dictionary\n"
                        "2. Provide an on-disk array like an h5py.Dataset") # pragma: no cover
        if isinstance(store, MutableMapping):
            name = 'cache-' + tokenize(self)
            dsk = dict(((name, k[1:]), (operator.setitem, store, (tuple, list(k)), k))
                    for k in core.flatten(self._keys()))
            Array._get(merge(dsk, self.dask), list(dsk.keys()), **kwargs)

            dsk2 = dict((k, (operator.getitem, store, (tuple, list(k))))
                        for k in store)
            return Array(dsk2, self.name, chunks=self.chunks, dtype=self._dtype)
Evaluate and cache array
dataset/ETHPy150Open dask/dask/dask/array/core.py/Array.cache