@@ -118,6 +118,7 @@ def makedirs(self, path, exist_ok=True):
118
118
raise FileExistsError (e .message )
119
119
120
120
raise e
121
+ self .invalidate_cache (self ._parent (path ))
121
122
122
123
def mkdir (self , path , create_parents = True , ** kwargs ):
123
124
"""
@@ -163,6 +164,7 @@ def rm(self, path, recursive=False):
163
164
raise OSError (e .message )
164
165
165
166
raise e
167
+ self .invalidate_cache (self ._parent (path ))
166
168
167
169
def mv (self , source_path , destination_path , recursive = False , maxdepth = None ):
168
170
"""
@@ -205,6 +207,8 @@ def mv(self, source_path, destination_path, recursive=False, maxdepth=None):
205
207
raise FileExistsError (e .message )
206
208
207
209
raise e
210
+ self .invalidate_cache (self ._parent (source_path ))
211
+ self .invalidate_cache (self ._parent (destination_path ))
208
212
209
213
def _open (self , path , mode = "rb" , block_size = "default" , ** kwargs ):
210
214
"""
@@ -364,6 +368,13 @@ def _get_data(self, path, start, end):
364
368
365
369
raise e
366
370
371
+ def invalidate_cache (self , path = None ):
372
+ if path is None :
373
+ self .dircache .clear ()
374
+ else :
375
+ self .dircache .pop (path , None )
376
+ super ().invalidate_cache (path )
377
+
367
378
368
379
class DatabricksFile (AbstractBufferedFile ):
369
380
"""
0 commit comments