Take an open cache file `f` and delete it if it's expired.
(self, f)
| 145 | self._delete(fname) |
| 146 | |
| 147 | def _is_expired(self, f): |
| 148 | """ |
| 149 | Take an open cache file `f` and delete it if it's expired. |
| 150 | """ |
| 151 | try: |
| 152 | exp = pickle.load(f) |
| 153 | except EOFError: |
| 154 | exp = 0 # An empty file is considered expired. |
| 155 | if exp is not None and exp < time.time(): |
| 156 | f.close() # On Windows a file has to be closed before deleting |
| 157 | self._delete(f.name) |
| 158 | return True |
| 159 | return False |
| 160 | |
| 161 | def _list_cache_files(self): |
| 162 | """ |