Example #1
0
    def _open_read(self, image_meta, mode):
        image_id = image_meta['id']
        path = self.path_for_image(image_id)
        with open(path, mode) as cache_file:
            yield cache_file

        utils.inc_xattr(path, 'hits')  # bump the hit count
Example #2
0
    def _open_read(self, image_meta, mode):
        image_id = image_meta['id']
        path = self.path_for_image(image_id)
        with open(path, mode) as cache_file:
            yield cache_file

        utils.inc_xattr(path, 'hits')  # bump the hit count
Example #3
0
    def open_for_read(self, image_id):
        path = self.path_for_image(image_id)
        with open(path, 'rb') as cache_file:
            yield cache_file

        utils.inc_xattr(path, 'hits')  # bump the hit count