Skip to content

[Bug]:【python】the data appears as garbled characters on Redis. #2260

@YmaYeah

Description

@YmaYeah

Preconditions (Any important steps we need to know)
1.【not sure】pip install django-redis
2.【must be】Configurate file configuration(in file settings)
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_KWARGS": {"max_connections": 100}
}
}
}

Steps to reproduce (How to reproduce what you found step by step)
1.[Configurate url]
urlpatterns = [path('redis_test/',RedisTestView.as_view())]

2.[Configurate view]
class RedisTestView(APIView):
def get(self,request):
cache.set('star',[1,2,3])
return ApiResponse()

3.[Test in Postman]
http://127.0.0.1:8000/api/v1/home/redis_test/
Actual behavior (A short description of what you found)
the data appears as garbled characters on Redis
key:":1:star" val:'����]�(K�K�K�e.'
Expected behavior (A short description of what you expected to find)
key:":1:star" val:"[1, 2, 3]"by pickle.loads

Screenshots (Paste or drag-and-drop a screenshot or a link to a recording)
image

Additional context (Operating system, version of RedisInsight, Redis database version, Redis module version, database type, connection type, logs, or any other information)
Operating system:macOS Ventura 13.0
version of RedisInsight:2.26.0
Redis database version:7.0.11 (bottled), HEAD
Redis module version:redis 7.0.11_1
connection type:NoSQL
version of Django:3.2.12
version of django-redis:5.3.0

Metadata

Metadata

Assignees

Labels

issueSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions