diff --git a/pipelib/core.py b/pipelib/core.py
index ec31d3e..2329b66 100644
--- a/pipelib/core.py
+++ b/pipelib/core.py
@@ -4,14 +4,13 @@ from pathlib import Path
 from itertools import chain, islice, tee
 from collections import deque
 
-import pipelib
 from pipelib import parallel
 from pipelib import iterators
 
 
 class Dataset:
     def __init__(self, dataset):
-        if isinstance(dataset, pipelib.Dataset):
+        if isinstance(dataset, Dataset):
             self._dataset = dataset._dataset
         else:
             self._dataset = dataset
@@ -67,14 +66,14 @@ class Dataset:
         return PipelinedDataset(self, f)
 
     def zip(self, *others):
-        assert all(isinstance(other, pipelib.Dataset) for other in others)
+        assert all(isinstance(other, Dataset) for other in others)
 
         def f(dataset):
             yield from zip(dataset, *others)
         return PipelinedDataset(self, f)
 
     def concat(self, *others):
-        assert all(isinstance(other, pipelib.Dataset) for other in others)
+        assert all(isinstance(other, Dataset) for other in others)
 
         def f(dataset):
             yield from chain(dataset, *others)
@@ -102,10 +101,10 @@ class Dataset:
         return next(iter(self))
 
     def save(self, filename):
-        evaluated_dataset = list(self)
+        cache = list(self)
         with open(filename, 'wb') as f:
-            pickle.dump(evaluated_dataset, f)
-        return self
+            pickle.dump(cache, f)
+        return CacheDataset(self, cache)
 
     @staticmethod
     def load(filename):
@@ -137,7 +136,7 @@ class _NestedFunc:
 class PipelinedDataset(Dataset):
 
     def __init__(self, dataset, func):
-        if not isinstance(dataset, pipelib.core.PipelinedDataset):
+        if not isinstance(dataset, PipelinedDataset):
             self._func = func
         else:
             self._func = _NestedFunc(dataset._func, func)
@@ -148,6 +147,16 @@ class PipelinedDataset(Dataset):
         yield from self._func(self._dataset)
 
 
+class CacheDataset(PipelinedDataset):
+
+    def __init__(self, dataset, cache):
+        super().__init__(dataset, lambda x: x)
+        self._cache = cache
+
+    def __iter__(self):
+        yield from self._cache
+
+
 class _Repeated:
     __slots__ = ['_generator', '_args', '_kwargs']
 
diff --git a/setup.py b/setup.py
index 75a9f8e..f4b0f3d 100644
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@ except ImportError:
 
 setup(
     name='pipelib',
-    version='0.2.3',
+    version='0.2.4',
     description='minimal data pipeline library for Python',
     long_description=open('./README.md', encoding='utf-8').read(),
     long_description_content_type='text/markdown',

Fix bug in Dataset.save
```py
class Dataset:
    def save(self, filename):
        evaluated_dataset = list(self)
        with open(filename, 'wb') as f:
            pickle.dump(evaluated_dataset, f)
        return EvaluatedDataset(evaluated_dataset)

class EvaluatedDataset(PipelinedDataset):
    ...
```
diff --git a/tests/test_core.py b/tests/test_core.py
index 41731c9..f76895a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -221,6 +221,14 @@ class DatasetTestCase(TestCase):
         expected = [x ** 2 for x in self.base if x % 2 == 0]
         self.assertListEqual(data.all(), expected)
         self.check_correct_pipelined_dataset(data, self.base)
+        self.assertIsInstance(data, pipelib.core.CacheDataset)
+
+        data = data.map(lambda x: x ** 2)
+        result = list(data._func(self.base))
+        expected = [x ** 2 for x in expected]
+        self.assertListEqual(data.all(), expected)
+        self.assertListEqual(result, expected)
+        self.check_correct_pipelined_dataset(data, self.base)
 
     @patch('pipelib.core.open')
     @patch('pipelib.core.pickle.load')

pip install -e .[dev]
parse_log_pytest
pytest
pytest
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
cloudpickle==2.2.1
dill==0.3.7
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
multiprocess==0.70.15
packaging @ file:///croot/packaging_1671697413597/work
-e git+https://github.com/yasufumy/pipelib.git@07b7c1b73652b4ca9056de962bf2fb020ca5c8de#egg=pipelib
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work

name: pipelib
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=22.1.0=py37h06a4308_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - flit-core=3.6.0=pyhd3eb1b0_0
  - importlib-metadata=4.11.3=py37h06a4308_0
  - importlib_metadata=4.11.3=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=22.0=py37h06a4308_0
  - pip=22.3.1=py37h06a4308_0
  - pluggy=1.0.0=py37h06a4308_1
  - py=1.11.0=pyhd3eb1b0_0
  - pytest=7.1.2=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py37h06a4308_0
  - typing_extensions=4.4.0=py37h06a4308_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.11.0=py37h06a4308_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cloudpickle==2.2.1
      - dill==0.3.7
      - multiprocess==0.70.15
prefix: /opt/conda/envs/pipelib

tests/test_core.py::DatasetTestCase::test_save
tests/test_core.py::DatasetTestCase::test_all tests/test_core.py::DatasetTestCase::test_apply tests/test_core.py::DatasetTestCase::test_batch tests/test_core.py::DatasetTestCase::test_concat tests/test_core.py::DatasetTestCase::test_filter tests/test_core.py::DatasetTestCase::test_filter_parallel tests/test_core.py::DatasetTestCase::test_first tests/test_core.py::DatasetTestCase::test_flat_map tests/test_core.py::DatasetTestCase::test_flat_map_parallel tests/test_core.py::DatasetTestCase::test_get_prefetch_iterator tests/test_core.py::DatasetTestCase::test_load tests/test_core.py::DatasetTestCase::test_map tests/test_core.py::DatasetTestCase::test_map_parallel tests/test_core.py::DatasetTestCase::test_method_chain tests/test_core.py::DatasetTestCase::test_repeat tests/test_core.py::DatasetTestCase::test_shuffle tests/test_core.py::DatasetTestCase::test_take tests/test_core.py::DatasetTestCase::test_window tests/test_core.py::DatasetTestCase::test_zip tests/test_core.py::TextDatasetTestCase::test_text tests/test_core.py::DirDatasetTestCase::test_directory
setup.py pipelib/core.py
setup.py pipelib/core.py