Saturday, February 20, 2016

Force Browser Caching image in Cake 3.x

How can I force a browser caching in Cake 3.2?

I have an avatar image in my navbar (menu) that is served by a cake response action:

public function showAvatar($funcionario_id) {
        $this->response->file(ROOT . "/files/funcionarios/avatars/$funcionario_id . '.jpg'");

        $this->response->cache('-1 minute', '+5 days');

        return $this->response;
    }

But in firebug, I see that this image is not cached in browser.

Am I doing something wrong?

Thanks You in advance

Nilson

--
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
 
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: