﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34271	Add a simple page caching method	Niccolò Mineo	nobody	"Since the current `cache_page` implementation caches according to the client and it is quite limiting in that sense, I'd like to propose a companion to such method to cache according to the path only. Something along these lines:

{{{
from pathlib import Path

from django.conf import settings
from django.core.cache import caches

default_cache = caches[settings.CACHE_MIDDLEWARE_ALIAS]
cache_key = ""."".join(Path(request.path[1:]).parts)

if not (response := default_cache.get(cache_key)):
    response = view_func(request, *args, **kwargs)
    response.add_post_render_callback(
        lambda r: default_cache.set(cache_key, r, timeout)
    )
}}}
"	Uncategorized	closed	Core (Cache system)	4.1	Normal	duplicate		Ahter Sönmez	Unreviewed	0	0	0	0	0	0
