@contextmanager
    def open_for_read(self, image_id):
        path = self.get_image_filepath(image_id)
        with open(path, 'rb') as cache_file:
            yield cache_file
        now = time.time()
        with self.get_db() as db:
            db.execute("""UPDATE cached_images
                       SET hits = hits + 1, last_accessed = ?
                       WHERE image_id = ?""",
                       (now, image_id))
            db.commit()
Implementation of 'partition-table create' command.
dataset/ETHPy150Open rcbops/glance-buildpackage/glance/image_cache/drivers/sqlite.py/Driver.open_for_read--crossover with--dataset/ETHPy150Open openlmi/openlmi-scripts/commands/storage/lmi/scripts/storage/cmd/partition_table.py/PartitionTableCreate.execute