inventree_part_import icon indicating copy to clipboard operation
inventree_part_import copied to clipboard

A disk-based cache for all provider queries to prevent provider API throttling

Open randrej opened this issue 1 month ago • 2 comments

If you play around with settings and importing parts too much, you might get yourself throttled or blocked by the providers. Adding caching would prevent you from repeating the same queries to the providers, saving you from this fate.

Might make sense to use something like diskcache (sqlite-based) to cache all provider queries based on the arguments, with a configurable TTL (say 6h for a default).

This would imply that if you have caching enabled, whenever you search for a part or similar, the result is cached. If you search for it again in the next n hours, you'll just get the cached response and you won't hit the API again, lessening the chance of getting yourself throttled.

Might make sense to add a CLI arg for avoiding cache, and a subcommand or flag for clearing it.

randrej avatar May 18 '24 16:05 randrej