-
-
Notifications
You must be signed in to change notification settings - Fork 356
Propose a way for user to use symfony cache with #70
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
Conversation
1500652
to
1f0cde0
Compare
src/LazyImage/README.md
Outdated
$cacheKey = $slugger->slug(implode('-', func_get_args())); | ||
|
||
$value = $this->cache->get($cacheKey, function (ItemInterface $item) use ($filename, $width, $height, $encodingWidth, $encodingHeight) { | ||
if (!$item->isHit()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no need for this check inside a cache callback
src/LazyImage/README.md
Outdated
|
||
$value = $this->cache->get($cacheKey, function (ItemInterface $item) use ($filename, $width, $height, $encodingWidth, $encodingHeight) { | ||
if (!$item->isHit()) { | ||
$item->set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neither this is needed - just return the value, the pool will set the item :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh thanks for the review, i missread the doc :)
749b546
to
c44e958
Compare
To not regenerate each time blurhash
c44e958
to
eb571ca
Compare
public function __construct(private BlurHashInterface $blurHash, private CacheInterface $cache) | ||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is PHP 8 code and I don't think we want documentation/examples to be written with.
I think it would be better to write code compatible with the lowest PHP requirement which is 7.2.5.
WDYT?
I like this PR... but can't we go further? It feels like the blurhash should always cache. Or, at the very worst, you just add one line of configuration (e.g. to point it at a cache pool, perhaps) and caching is all setup. |
Hi, I'm sorry but I've just seen this PR this exists, and BlurHash caching has been implemented in #1755. |
To not regenerate each time blurhash
Just for helping devs implementing cache with symfony/cache