Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • SensioLabs Professional services to help you with Symfony
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by SensioLabs
  1. Home
  2. Documentation
  3. Bundles
  4. LiipImagineBundle
  5. Cache Resolver (deprecated)
  • Documentation
  • Book
  • Reference
  • Bundles
  • Cloud

Table of Contents

  • Dependencies
  • Configuration
  • Usage
    • Usage on a Specific Filter

Cache Resolver (deprecated)

Edit this page

Cache Resolver (deprecated)

Warning

This cache resolver is based on the discontinued Doctrine Cache library.

It is recommended to use the PsrCacheResolver instead.

The CacheResolver cannot be used by itself. Instead, it is a "wrapper" for another resolver.

Dependencies

This cache resolver requires the Doctrine Cache library, which can be installed by executing the following command in your project directory:

1
$ composer require doctrine/cache

Configuration

First, you need to setup the required services. In this example we're wrapping an instance of AmazonS3Resolver inside this resolver.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# app/config/services.yml

services:
    acme.amazon_s3:
        class: AmazonS3
        arguments:
            -
                key:    "%amazon_s3.key%"
                secret: "%amazon_s3.secret%"

    acme.imagine.cache.resolver.amazon_s3:
        class: Liip\ImagineBundle\Imagine\Cache\Resolver\AmazonS3Resolver
        arguments:
            - "@acme.amazon_s3"
            - "%amazon_s3.bucket%"

    memcache:
        class: Memcache
        calls:
            - [ connect, [ "127.0.0.1", 11211 ] ]

    cache.memcache:
        class: Doctrine\Common\Cache\MemcacheCache
        calls:
            - [ setMemcache, [ "@memcache" ] ]

    acme.imagine.cache.resolver.amazon_s3.cache:
        class: Liip\ImagineBundle\Imagine\Cache\Resolver\CacheResolver
        arguments:
            - "@cache.memcache"
            - "@acme.imagine.cache.resolver.amazon_s3"
            - { prefix: "amazon_s3" }
        tags:
            - { name: "liip_imagine.cache.resolver", resolver: "cached_amazon_s3" }

There are three options available:

  • global_prefix: A prefix for all keys within the cache. This is useful to avoid colliding keys when using the same cache for different systems.
  • prefix: A "local" prefix for this wrapper. This is useful when re-using the same resolver for multiple filters. This mainly affects the clear method.
  • index_key: The name of the index key being used to save a list of created cache keys regarding one image and filter pairing.

Usage

After configuring CacheResolver, you can set it as the default cache resolver for LiipImagineBundle using the following configuration.

1
2
3
4
# app/config/config.yml

liip_imagine:
    cache: cached_amazon_s3

Usage on a Specific Filter

Alternatively, you can set CacheResolver as the cache resolver for a specific filter set using the following configuration.

1
2
3
4
5
6
7
8
9
# app/config/config.yml

liip_imagine:
    filter_sets:
        cache: ~
        my_thumb:
            cache: cached_amazon_s3
            filters:
                # the filter list
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version
    We stand with Ukraine.
    Version:
    Measure & Improve Symfony Code Performance

    Measure & Improve Symfony Code Performance

    Peruse our complete Symfony & PHP solutions catalog for your web development needs.

    Peruse our complete Symfony & PHP solutions catalog for your web development needs.

    Symfony footer

    ↓ Our footer now uses the colors of the Ukrainian flag because Symfony stands with the people of Ukraine.

    Avatar of Lance Chen, a Symfony contributor

    Thanks Lance Chen for being a Symfony contributor

    1 commit • 17 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • Symfony at a Glance
      • Symfony Components
      • Case Studies
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • SymfonyConnect
      • Support
      • How to be Involved
      • Code of Conduct
      • Events & Meetups
      • Projects using Symfony
      • Downloads Stats
      • Contributors
      • Backers
    • Blog

      • Events & Meetups
      • A week of symfony
      • Case studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Documentation
      • Living on the edge
      • Releases
      • Security Advisories
      • SymfonyInsight
      • Twig
      • SensioLabs
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Deployed on

    Follow Symfony

    Search by Meilisearch