Ejemplo n.º 1
0
    def GetImageRenderer(self, media):

        hash = media.GetHash()

        key = hash

        result = self._data_cache.GetIfHasData(key)

        if result is None:

            image_renderer = ClientRendering.ImageRenderer(media)

            # we are no longer going to let big lads flush the whole cache. they can render on demand

            image_cache_storage_limit_percentage = self._controller.new_options.GetInteger(
                'image_cache_storage_limit_percentage')

            if image_renderer.GetEstimatedMemoryFootprint(
            ) < self._data_cache.GetSizeLimit() * (
                    image_cache_storage_limit_percentage / 100):

                self._data_cache.AddData(key, image_renderer)

        else:

            image_renderer = result

        return image_renderer
Ejemplo n.º 2
0
    def GetImageRenderer(self, media):

        hash = media.GetHash()

        key = hash

        result = self._data_cache.GetIfHasData(key)

        if result is None:

            image_renderer = ClientRendering.ImageRenderer(media)

            self._data_cache.AddData(key, image_renderer)

        else:

            image_renderer = result

        return image_renderer