MCPcopy Index your code
hub / github.com/clips/pattern / clear

Method clear

pattern/web/cache/__init__.py:125–131  ·  view source on GitHub ↗

Clears all items from the cache (whose age is the given amount of days or older).

(self, age=None)

Source from the content-addressed store, hash-verified

123 return os.path.exists(p) and (date_now() - date_modified(p)).days or 0
124
125 def clear(self, age=None):
126 """ Clears all items from the cache (whose age is the given amount of days or older).
127 """
128 n = date_now()
129 for p in glob.glob(os.path.join(self.path, "*")):
130 if age is None or (n - date_modified(p)).days >= age:
131 os.unlink(p)
132
133cache = Cache()

Callers 2

popContentMethod · 0.45
_end_sourceMethod · 0.45

Calls 2

date_nowFunction · 0.85
date_modifiedFunction · 0.85

Tested by

no test coverage detected