MCPcopy Create free account
hub / github.com/requests-cache/requests-cache / clear

Method clear

requests_cache/backends/sqlite.py:74–85  ·  view source on GitHub ↗

Delete all items from the cache. If this fails due to a corrupted cache or other I/O error, this will attempt to delete the cache file and re-initialize.

(self)

Source from the content-addressed store, hash-verified

72 return self.responses.db_path
73
74 def clear(self):
75 """Delete all items from the cache. If this fails due to a corrupted cache or other I/O
76 error, this will attempt to delete the cache file and re-initialize.
77 """
78 try:
79 super().clear()
80 except Exception:
81 logger.exception('Failed to clear cache')
82 if isfile(self.responses.db_path):
83 unlink(self.responses.db_path)
84 self.responses.init_db()
85 self.redirects.init_db()
86
87 # A more efficient SQLite implementation of BaseCache.delete
88 def delete(

Callers

nothing calls this directly

Calls 2

clearMethod · 0.45
init_dbMethod · 0.45

Tested by

no test coverage detected