-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Making CachingStrategy available in Cache #118
Comments
Hi @tacman, I've just push an update that may solve your problem. Also, I created a new interface <?php
declare(strict_types=1);
namespace Acme;
use SpomkyLabs\PwaBundle\Service\HasCacheStrategies;
final readonly class ListCacheStrategies
{
/**
* @param iterable<HasCacheStrategies> $cacheStrategyServices
*/
public function __construct(
#[TaggedIterator('spomky_labs_pwa.cache_strategy')]
private iterable $cacheStrategyServices,
) {
}
public function doWhatYouWant(): array
{
foreach($this->cacheStrategyServices as $service) {
$strategies = $service->getCacheStrategies();
///
}
}
} |
Note that warm cache Urls are not yet managed. |
I created a command to demonstrate how it works: symfony console pwa:cache:list-strategies |
Awesome! I'll integrate it now. |
Hi, The URLs and plugins are now part of the returned data. Regards. |
Thanks! I hope to have something soon, this is more complicated than I'd hoped, but I think is going to be helpful to anyone working with the bundle. The debug toolbar is already pointing out an issue. The planet pages never changes, but the voyages do. So I want to serve the cached planet page, and make a turbo/stimulus/ajax call to /planet/3/_voyages to get the html snippet showing the voyage, which has a different cache strategy. Or I could make an ajax call to get json or jsonld data, which might not have the appropriate extension, but will have a mime-type in the Response and of course will match /api. I should have something to show soon. What do you think about an EventListener to populate the cacheStrategy and preload pages? |
Yesterday I was thinking about a way to serve pages with different caching strategies. I implement that only for the purge_cache that is intended to by used when navigating. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
I'd like to add the caching strategy to the debug toolbar, I think it's one of the most critical pieces of information. Related to #117 and #113
Example
Perhaps when we implement the CacheInterface with the common methods, we could add a getCacheStrategy(). But I could be completely wrong about where the strategy is defined.
The text was updated successfully, but these errors were encountered: