[Enhancement Proposal] - Cache for route registration potentially grow infinitely during application time. #1438
Replies: 1 comment
-
| 
         Hi @kanin-kearpimy, that's a good point! 
 I understand your concern, but this will not be the case Suppose we have a code like this: function thing({ params: { id } }) {
    return 'hello'
}Sucrose uses an actual code of a function by using  You can try logging  So the cache is scaled with the total routes, and the lifecycle function that is used in Elysia Even if the user accidentally causes an infinite loop, it's unlikely that the  Sucrose cache will then be cleared when the server starts with  However, you made a totally valid point on the time limit in case the user doesn't use   | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey @SaltyAom
I've found something interesting during application on Elysia is running.
As of my knowledge, Elysia has mechanism to cache interface initialisation such as router registration like below.
That is totally great! So, we don't need to compute the whole interface again.
However, I noticed that when it come to cases like
It's possible that
:idwhich is dynamic and can grow infinitely will affect the cache size, so do memory consumption during Elysia runtime.I'm not sure you think this is problem as of now, or you have something in mind to handle this in upcoming version.
I have a proposal for this.
Please let me know what you think. If it sound good. I can open PR and let you review it.
Best,
(James) Kanin Kearpimy
Beta Was this translation helpful? Give feedback.
All reactions