zfcampus / zf-http-cache

ZF2 module for automating http cache tasks within a Zend Framework 2 application.
BSD 3-Clause "New" or "Revised" License
8 stars 6 forks source link

Impossible to use a custom etag generator per rule #18

Open tonivdv opened 5 years ago

tonivdv commented 5 years ago

Provide a narrative description of what you are trying to accomplish.

Code to reproduce the issue

return [
    'zf-http-cache' => [
        'enable' => true,
        'controllers' => [
            'User\Controller\User::userAvatar' => [
                'get' => [
                    'etag' => [
                        'override' => false,
                        'generator' => \Adsdaq\Infrastructure\Cache\Http\AdsdaqETagGenerator::class,
                    ]
                ]
            ],
        ]
    ]
]

Expected results

I expect that for this Controller action that specific etag generator would be used.

Actual results

The default etag generator keeps being used.

My observations

Looking at the code and unit tests it was clear to me that it's only possible to load a global custom etag generator via:

return [
    'zf-http-cache' => [
        'enable' => true,
        'etag' => [
            'generator' => \Adsdaq\Infrastructure\Cache\Http\AdsdaqETagGenerator::class,
        ],
        'controllers' => [
           ...
        ]
    ]
]

If my observations are right, what are the expectations, should it be possible to a) inject custom etag per rule or b) update the documentation to align with a single global override.

Or am I completely missing something?

Thanks in advance

Cheers

weierophinney commented 4 years ago

This repository has been closed and moved to laminas-api-tools/api-tools-http-cache; a new issue has been opened at https://github.com/laminas-api-tools/api-tools-http-cache/issues/2.