Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added note about refresh and POSIX behavior #648

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gcsfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,13 @@ class GCSFileSystem(asyn.AsyncFileSystem):
GCSFileSystem maintains a per-implied-directory cache of object listings and
fulfills all object information and listing requests from cache. This implied, for example, that objects
created via other processes *will not* be visible to the GCSFileSystem until the cache
refreshed. Calls to GCSFileSystem.open and calls to GCSFile are not effected by this cache.
refreshed. Calls to GCSFileSystem.open and calls to GCSFile are not affected by this cache.

*Note that caching creates divergences from the behavior of POSIX utilities such as 'ls'*. In a POSIX
filesystem, ls always returns the current state of a directory; however, if `refresh = False` (the
default), ls returns the state of the cache. `refresh = False` is the default because (unlike in a POSIX filesystem)
listing directory contents of a GCS bucket can be expensive. Developers are advised to set `refresh = True`
if exact POSIX behavior is desired.
martindurant marked this conversation as resolved.
Show resolved Hide resolved

In the default case the cache is never expired. This may be controlled via the ``cache_timeout``
GCSFileSystem parameter or via explicit calls to ``GCSFileSystem.invalidate_cache``.
Expand Down