zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Feature Request] Caching Mechanism for `zenstack generate` Command

Open tmax22 opened this issue 1 year ago • 2 comments

Hello Zenstack Team,

I'm writing to request a caching mechanism for the zenstack generate command. Currently, when dealing with large schemas containing many tables, the generation process becomes time-consuming.

  1. Caching: Implement a caching system that stores results from previous runs and reuses them if the schema hasn’t changed.
    • each plugin should decide for himself if it is safe to skip.
    • if plugin has not skipped, internal skips within each plugin can take place. for example, save cache for generated hooks/zod schemas per each table. if table wasn't change can take values from cache.
  2. Cache Invalidation: Provide a --no-cache or --force flag to manually invalidate the cache and regenerate everything from scratch.

currently generation for us takes few minutes and keeps going up. implementing such caching mechanism can easily speed up generation process from 10 minutes to few seconds.

and once again, thank for the amazing zenstack framework.

tmax22 avatar Jul 02 '24 13:07 tmax22

Hi @tmax22 , yes, I can understand it gets painful when the schema gets more and more complex. We'll think about this and also the overall generation performance. Thanks for the continuous support!

ymc9 avatar Jul 12 '24 21:07 ymc9

Great suggestion! 🎉

I completely agree - as the schema grows, the generation time increases significantly, which can be quite a bottleneck. Implementing a caching mechanism would be a game-changer for anyone working with large and complex schemas. It would drastically improve productivity by cutting down the generation time from minutes to seconds. A --no-cache or --force flag is also a brilliant addition, giving users full control over when to refresh the cache.

Looking forward to any updates on this – it would be amazing to know if there’s any progress on implementing this feature! 🚀

baenio avatar Sep 28 '24 17:09 baenio