Update the cache items with new replacement for current epoch.
(self)
| 1154 | self._replace_mgr.start() |
| 1155 | |
| 1156 | def _try_update_cache(self): |
| 1157 | """ |
| 1158 | Update the cache items with new replacement for current epoch. |
| 1159 | |
| 1160 | """ |
| 1161 | with self._update_lock: |
| 1162 | if not self._replace_done: |
| 1163 | return False |
| 1164 | |
| 1165 | del self._cache[: self._replace_num] |
| 1166 | self._cache.extend(self._replacements) |
| 1167 | |
| 1168 | self._start_pos += self._replace_num |
| 1169 | if self._start_pos >= self._total_num: |
| 1170 | self._start_pos -= self._total_num |
| 1171 | |
| 1172 | self._compute_data_idx() |
| 1173 | |
| 1174 | # ready for next round |
| 1175 | self._round += 1 |
| 1176 | self._replace_done = False |
| 1177 | return True |
| 1178 | |
| 1179 | def update_cache(self): |
| 1180 | """ |
no test coverage detected