Check if image exists in cache. Args: image_path: Image path to check. Returns: bool: True if image exists.
(self, image_path: str)
| 251 | return shard_id, hex_digest.encode() |
| 252 | |
| 253 | def exists(self, image_path: str) -> bool: |
| 254 | """Check if image exists in cache. |
| 255 | |
| 256 | Args: |
| 257 | image_path: Image path to check. |
| 258 | |
| 259 | Returns: |
| 260 | bool: True if image exists. |
| 261 | """ |
| 262 | shard_id, key = self._get_shard_id_and_key(image_path) |
| 263 | env = self._get_env(shard_id) |
| 264 | |
| 265 | with env.begin(write=False) as txn: |
| 266 | return txn.get(key) is not None |
| 267 | |
| 268 | def put(self, image_path: str, img_bytes: bytes) -> bool: |
| 269 | """Write a single image to cache. |