Giter Site home page Giter Site logo

Why pickle strings? about django-redis HOT 4 CLOSED

jazzband avatar jazzband commented on June 21, 2024
Why pickle strings?

from django-redis.

Comments (4)

niwinz avatar niwinz commented on June 21, 2024 1

As workaround, if you want store raw strings, you can use redis_cache.get_redis_connection(alias) for obtain a raw redis client and use it for store raw strings without serializing.

Also, you can subclass the default client, and overwrite pickle and unpickle methods with own behavior (WARNING: in future release these methods will change to serialize/deserialize ;))

from django-redis.

niwinz avatar niwinz commented on June 21, 2024

Hi @askaliuk

I have used pickle for serialize everything for conserve the real type for everything (django-redis-cache was some bugs related to serialize string, but deserializes integer...)

Now, django-redis deals with integer values as special values and stores it without pickling, allowing
redis atomic operations over it. And... now if I enable string storage without pickling, the previous strange and inconsistent behavior will return (when I set("foo", "1"), get("foo") will return 1 (int))

For more information: https://github.com/niwibe/django-redis/blob/master/redis_cache/client/default.py#L281

If you know any better approach for it, maintaining atomic operations for integers, improvements are welcome.

from django-redis.

askaliuk avatar askaliuk commented on June 21, 2024

Thank you @niwibe for explanation.
I don't have good ideas for now, so feel free to close this issue.

from django-redis.

niwinz avatar niwinz commented on June 21, 2024

Thanks to you for your interest! ;)

from django-redis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.