flask-caching icon indicating copy to clipboard operation
flask-caching copied to clipboard

Memoize doesn't give correct results with list as one of the parameter in API

Open ashsharma96 opened this issue 2 years ago • 6 comments

Hey Flask Caching Team,

When I tried to apply memoize decorator on one of my api which requires different parameters then its not giving right results. For Example these are my api parameters:

{
  "Id": 11082,
  "Type": "QA",
  "stores":[1234, 2345, 3456, 4567]
}

Function returns :

Total Customer: 3000

Decorator I used for above parameters are:

@cache.memoize(timeout=30)

Configuration I used:

config={'CACHE_TYPE': 'SimpleCache'}

stores key in parameters takes a list which can take one or more than one numbers. For example when I use above mentioned parameters I get number of customers in these stores but lets say I reduce the parameters to below parameters:

 {
  "Id": 11082,
  "Type": "QA",
  "stores":[1234]
}

It should return result shared below:

Total Customer: 900

But for 30 seconds it shows 3000 and after 30 seconds it shows 900 customers. So is there are any way by which memoize can determine like if there's any change in the list of parameters.

Environment:

  • Python version: 3.7.6
  • Flask-Caching version: 2.0.2

ashsharma96 avatar Jan 30 '23 09:01 ashsharma96

@sh4nks Can you please check this one. This one is urgent. Regards

ashsharma96 avatar Jan 30 '23 10:01 ashsharma96

@sh4nks anything on this one. Little urgent.

ashsharma96 avatar Feb 08 '23 06:02 ashsharma96

@sh4nks Can you please look into this. Its Urgent.

ashsharma96 avatar Feb 09 '23 05:02 ashsharma96

@ashsharma96 I am sorry but I won't really have time for this. I have a full-time job, a family with a toddler so time is kinda precious for me! You can always investigate the issue yourself by checking out the repo.

sh4nks avatar Feb 09 '23 09:02 sh4nks

@sh4nks Thanks for replying. I know everyone is busy but you are working on this library. That's why I asked you. Everyone have personal life. I just thought you may know this. Sorry to disturb you.

ashsharma96 avatar Feb 14 '23 10:02 ashsharma96

Hi @northernSage! Do you have free time for it?

EugeneTorap avatar Feb 14 '23 13:02 EugeneTorap