#36020: redis cache backend serializing floats
--------------------------+------------------------------------------------
     Reporter:  amirreza  |                     Type:  Cleanup/optimization
       Status:  new       |                Component:  Core (Cache system)
      Version:  5.1       |                 Severity:  Normal
     Keywords:            |             Triage Stage:  Unreviewed
    Has patch:  0         |      Needs documentation:  0
  Needs tests:  0         |  Patch needs improvement:  0
Easy pickings:  1         |                    UI/UX:  0
--------------------------+------------------------------------------------
 hi
 so as you know django's redis backend
 
[https://github.com/django/django/blob/main/django/core/cache/backends/redis.py#L19-L27]
 doesn't serialize int values, this is to support atomic integer operation
 as discussed at
 [https://github.com/django/django/pull/14437#issuecomment-915046037] and
 below.

 but redis also has float operations, such as `incrbyfloat`, and since
 django serializes floats these operations are not possible, at least not
 without some hassle

 we can easily address this by not serializing floats

 worth mentioning that i've recently done the same thing in `django-valkey`
 [https://github.com/amirreza8002/django-
 valkey/blob/main/django_valkey/base_client.py#L527-L552], and from what i
 can tell, it makes no difference for users and doesn't break anything.

 let me know what you think
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36020>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070193d43fabf2-01a69aa7-7117-4f09-a563-a97cd08a4280-000000%40eu-central-1.amazonses.com.

Reply via email to