Skip to content

Commit 804057f

Browse files
authored
Set default cache type to "readahead" (#678)
See analysis by @sneha5gsm in #677
1 parent f57f9d8 commit 804057f

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎s3fs/core.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,10 @@ class S3FileSystem(AsyncFileSystem):
205205
default_fill_cache : Bool (True)
206206
Whether to use cache filling with open by default. Refer to
207207
``S3File.open``.
208-
default_cache_type : string ('bytes')
208+
default_cache_type : string ("readahead")
209209
If given, the default cache_type value used for ``open()``. Set to "none"
210210
if no caching is desired. See fsspec's documentation for other available
211-
cache_type values. Default cache_type is 'bytes'.
211+
cache_type values. Default cache_type is "readahead".
212212
version_aware : bool (False)
213213
Whether to support bucket versioning. If enable this will require the
214214
user to have the necessary IAM permissions for dealing with versioned
@@ -265,7 +265,7 @@ def __init__(
265265
requester_pays=False,
266266
default_block_size=None,
267267
default_fill_cache=True,
268-
default_cache_type="bytes",
268+
default_cache_type="readahead",
269269
version_aware=False,
270270
config_kwargs=None,
271271
s3_additional_kwargs=None,
@@ -1972,7 +1972,7 @@ def __init__(
19721972
fill_cache=True,
19731973
s3_additional_kwargs=None,
19741974
autocommit=True,
1975-
cache_type="bytes",
1975+
cache_type="readahead",
19761976
requester_pays=False,
19771977
cache_options=None,
19781978
):

‎s3fs/tests/test_s3fs.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_simple(s3):
183183
assert out == data
184184

185185

186-
@pytest.mark.parametrize("default_cache_type", ["none", "bytes", "mmap"])
186+
@pytest.mark.parametrize("default_cache_type", ["none", "bytes", "mmap", "readahead"])
187187
def test_default_cache_type(s3, default_cache_type):
188188
data = b"a" * (10 * 2**20)
189189
s3 = S3FileSystem(
@@ -1024,7 +1024,7 @@ async def head_object(*args, **kwargs):
10241024

10251025
def test_read_small(s3):
10261026
fn = test_bucket_name + "/2014-01-01.csv"
1027-
with s3.open(fn, "rb", block_size=10) as f:
1027+
with s3.open(fn, "rb", block_size=10, cache_type="bytes") as f:
10281028
out = []
10291029
while True:
10301030
data = f.read(3)

0 commit comments

Comments
 (0)