Clears all items from the cache (whose age is the given amount of days or older).
(self, age=None)
| 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 | |
| 133 | cache = Cache() |
no test coverage detected