﻿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
33826	delete_many()/set_many() crashes with empty values on Redis client .	Christos Kopanos	Christos Kopanos	"I am not sure the behavior described below is the intended (in the sense that the code utilizing the cache backend should make sure to place those checks introduced before calling delete_many or set_many, however looking at the Database backend implementation similar checks do exist when calling the delete_many method and since I jumped into this bug using the redis backend a fix is needed I think to address this issue.

**Case**

If the 2 methods call the underlying redis client DEL and MSET commands with
empty parameters then an exception will be thrown by the redis client:

redis.exceptions.ResponseError: wrong number of arguments for 'del' command

and

redis.exceptions.ResponseError: Command # 1 (MSET) of pipeline caused error: wrong number of arguments for 'mset' command

respectively.

**Steps to reproduce**

Using


{{{
USE_TZ = False
DATABASES = {""default"": {""ENGINE"": ""django.db.backends.sqlite3"", ""NAME"": ""mydatabase""}}

CACHES = {
    ""default"": {
        ""BACKEND"": ""django.core.cache.backends.redis.RedisCache"",
        ""LOCATION"": ""redis://localhost:6379"",
    }
}
}}}


as a settings file run a shell


{{{
./manage.py shell --settings myapp.settings
from django.core.cache import cache
cache.delete_many([])
}}}


raises exception redis.exceptions.ResponseError: wrong number of arguments for 'del' command


{{{
cache.set_many({})
}}}


raises exception redis.exceptions.ResponseError: Command # 1 (MSET) of pipeline caused error: wrong number of arguments for 'mset' command"	Cleanup/optimization	closed	Core (Cache system)	4.0	Normal	fixed	redis		Ready for checkin	1	0	0	0	0	0
