Giter Club home page Giter Club logo

Comments (6)

ankush avatar ankush commented on June 18, 2024

User is supposed to be bool flag, cache is either user specific or not. Rest of rediswrapper works like this.

Passing actual string is only useful when you want to set cache for specific known user. We should just get rid of this functionality TBH 🥴

from frappe.

casesolved-co-uk avatar casesolved-co-uk commented on June 18, 2024

Every call that I looked at used user as a value not a bool

from frappe.

ankush avatar ankush commented on June 18, 2024

image

It's not used anywhere? Just added for sake of completeness.

from frappe.

casesolved-co-uk avatar casesolved-co-uk commented on June 18, 2024

I meant underneath: frappe.cache.get/set_value

from frappe.

ankush avatar ankush commented on June 18, 2024

if user:
if user is True:
user = frappe.session.user

from frappe.

casesolved-co-uk avatar casesolved-co-uk commented on June 18, 2024

Fair enough but I think this is not obvious and dangerous. The user parameter should be validated in the decorator as a bool only.

It even has a str type option:

def redis_cache(ttl: int | None = 3600, user: str | bool | None = None) -> Callable:

I was hoping to use it on this:
#26024

from frappe.

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.