Add special query to reset the cache

This commit is contained in:
Tim 2025-05-11 00:20:26 +02:00
parent d64cadb47b
commit 6adc8c4a69
2 changed files with 12 additions and 1 deletions

View File

@ -38,8 +38,12 @@ class RequestDtoCache implements ValueResolverInterface
$cacheData = $session->get($cacheKey, []);
$queryData = $request->query->all();
$params = $constructor->getParameters();
$args = [];
if (isset($queryData['reset'])) {
$queryData = $cacheData = [];
}
$args = [];
foreach ($params as $param) {
$name = $param->getName();
if (array_key_exists($name, $queryData)) {

View File

@ -28,7 +28,14 @@
{% block column2 %}
<h3>Filters</h3>
<div class="list-group">
<a href="{{ path('snip_index', {'reset': 1}) }}"
class="list-group-item list-group-item-action">
<i class="fa fa-refresh"></i> Reset
</a>
</div>
<br>
<h5>Sort by</h5>
<div class="list-group">
{% for sortOption in snipSortOptions() %}