forked from 00dani/lemoncurry
Provide our own MessagePack serialiser class for django-redis, since the included one doesn't work properly with msgpack <= 0.5.4
This commit is contained in:
parent
b59962a119
commit
8d4444cfb9
2 changed files with 12 additions and 1 deletions
11
lemoncurry/msgpack.py
Normal file
11
lemoncurry/msgpack.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import msgpack
|
||||||
|
|
||||||
|
from django_redis.serializers.base import BaseSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class MSGPackModernSerializer(BaseSerializer):
|
||||||
|
def dumps(self, value):
|
||||||
|
return msgpack.dumps(value)
|
||||||
|
|
||||||
|
def loads(self, value):
|
||||||
|
return msgpack.loads(value)
|
|
@ -157,7 +157,7 @@ CACHES = {
|
||||||
'KEY_PREFIX': 'lemoncurry',
|
'KEY_PREFIX': 'lemoncurry',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'PARSER_CLASS': 'redis.connection.HiredisParser',
|
'PARSER_CLASS': 'redis.connection.HiredisParser',
|
||||||
'SERIALIZER': 'django_redis.serializers.msgpack.MSGPackSerializer',
|
'SERIALIZER': 'lemoncurry.msgpack.MSGPackModernSerializer',
|
||||||
},
|
},
|
||||||
'VERSION': 2,
|
'VERSION': 2,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue