Redis Cache - Changing the key format

Did more research and found this: Django Docs

I changed my format to be:

  • key_prefix:version:cache:source:view_name:kwarg (if any):key

I ended up using key to pass args to the key_function to create this format but this is clearly overkill, but I couldn’t find another way.

Basically what i’m doing is using key_prefix to add something like {<kwarg1.value><kwarg2.value>} to extract my kwargs then i wipe the content between {} and use the original key but with the gigantic prefix, i know what you’re gonna say, this is terrible and i agree but i didn’t had any other idea since i didn’t want to override cache_page and it doesn’t allow kwargs to be passed to the key function