Giter Site home page Giter Site logo

Comments (8)

teferi avatar teferi commented on July 20, 2024

Does this mean that you use a custom make_key() function?
Django doesn't provide a way to convert key returned by make_key() back to original, but it might be a good idea to provide such a function smth like reverse_key() (or make_reverse_key() or reverse_make_key()) and allow it to be overridden for this purpose.

from django-redis.

askaliuk avatar askaliuk commented on July 20, 2024

Yes. https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-CACHES-KEY_FUNCTION

Correct. Django doesn't provide way to convert back. But django-redis blindly assumes that i use standard function and converts it back in the code line, which i mentioned.
I think make_reverse_key() should be defined somewhere in code (e.g. with standard implementation or NotImplementedError) and django-redis should provide way to override it.

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

Yes, django-redis asumes that default function is used.

I really like suggestions, any one have time for implement this? this month I'm really busy... :(

from django-redis.

teferi avatar teferi commented on July 20, 2024

I'll have some time to implement it this weekend (seems easy enough)

from django-redis.

teferi avatar teferi commented on July 20, 2024

I still wish to write some tests with custom functions (It turned out to be a little more tricky than I thought, as I cache the function on module level). Also is documentation inside doc/ the one I should update? I feel that we should warn users if they use custom KEY_FUNCTION.

Btw: is it even possible to just attach a PR to an issue without creating a new issue?

from django-redis.

teferi avatar teferi commented on July 20, 2024

Oh wait! I think I got it wrong. It should be a parameter to backend, not a separate setting.
Edit:
Fixed that, still have to add tests with custom function.

from django-redis.

teferi avatar teferi commented on July 20, 2024

I've written a test for custom function and fixed tests on all the pythons and djangos you test. =) @niwibe could you please review the #81 PR? I can squash commits if you wish, and I guess we should add info about the function to docs if code is ok.

from django-redis.

niwinz avatar niwinz commented on July 20, 2024

Merged and released ;) Thanks!

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.