Search code examples
flaskflask-cache

flask cache delete_many error


I'm not good at flask and a naturally django developer I was forced to because it is already developed..

May question is how to use delete_many using flask-cache

cache.delete_many(["sample_4", "sample_5"])

This returns an error:

TypeError: cannot concatenate 'str' and 'list' objects

I'm aware that this is the right way, but what I want is a list of keys as a parameter to be deleted

cache.delete_many("sample_3", "sample_2")

I


Solution

  • You can call delete_many with arguments unpacked from a list

    cache.delete_many(*["sample_4", "sample_5"])