Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache warmers #1258

Open
wants to merge 11 commits into
base: 2.x
Choose a base branch
from
Open

Cache warmers #1258

wants to merge 11 commits into from

Conversation

klavig
Copy link

@klavig klavig commented Jan 3, 2020

This is a feature, used by the company I work for.
Hopefully, this feature ends up in the master branch.

Steps to create a cache warmer:

  1. Create a service that implements WarmerInterface and warms up the images (descriptions for methods can be found in the interface);
  2. Tag it with liip_imagine.cache.warmer. Tag also requires a warmer parameter, which contains the name of the cache warmer. It can be used in the console command (read the next point);
  3. The console command liip:imagine:cache:warm finds all cache warmers and runs them, but you can also specify specific cache warmers separated by space: liip:imagine:cache:warm products_warmer brands_warmer. Run liip:imagine:cache:warm --help to read more.

Service example:

app.products_warmer:
    class: AppBundle\Imagine\ProductImagesWarmer
    tags:
        - { name: 'liip_imagine.cache.warmer', warmer: 'products_warmer' }

Filter example:

product_thumb_new_v2:
    quality: 85
    filters:
        thumbnail: { size: [450, 301], mode: inset }
        background: { size: [450, 301], color: '#FFFFFF' }
    warmers: [products_warmer]
    post_processors:
        jpegoptim: {}

If the description is missing information, it is misleading or hard to understand, let me know, so I can update it.

@lsmith77 lsmith77 changed the base branch from master to 2.x January 5, 2021 12:50
@coveralls
Copy link

coveralls commented Jan 22, 2021

Coverage Status

Coverage decreased (-4.6%) to 79.099% when pulling 873c8fb on keshancs:cache-warmers-remake into 469b178 on liip:2.x.

@dbu
Copy link
Member

dbu commented Oct 5, 2021

hi @keshancs , i am going through the backlog of older issues and merge requests.

thanks for the pull request. code looks good to me, but can you explain what the use case is? i would expect that usually, people keep the cached images between deployments. are you deploying image asset files that you convert with LiipImagineBundle to different sizes?

as this is a significant amount of code, i wonder if it would be better to make a separate bundle out of this. i would be happy to mention it in the documentation for people that have the same use case.

@dbu dbu added the Status: Waiting for Information This discussion required additional information before it can be resolved. label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Waiting for Information This discussion required additional information before it can be resolved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants