Product.get_subtypes should probably cache its answer.

Create issue
Issue #839 resolved
Nathan Ekstrom created an issue

I've noticed that Product.get_subtypes gets called quit often. Using the attached diff I had some speed improvements.

Comments (6)

  1. Chris Moffitt repo owner

    I like the idea of caching the call but this approach doesn't really cache. It would require a server restart every time a subtype change is made. This may be ok. I'll want to think about whether this is the right approach of whether or not we should use the cache to store it for a brief period of time.

  2. Nathan Ekstrom reporter

    Unless I wrote the code wrong it should only cache it on that instance and not on the class definition. So the very first time that get_subtypes is called on that instance, it goes and hits the database and then saves the result only to that instance. So you shouldn't have that problem you described. At least that is how it is supposed to work.

  3. Log in to comment