Sign In Register

How can we help you today?

Start a new topic
Answered

Should utility objects/methods be in a module or in SparkCache?

Hiya,


Should utility objects be placed in a module or should they be cached via SparkCache?


Specifically, I have an object in JavaScript that holds 20 or 30 utility methods (mostly underscore.js methods). At the moment, I have this object in its own module and I bring the module into a cloud code event binding via "require()". But since these utility methods aren't user-specific, would it be better to cache this object and access it via SparkCache?


Any thoughts?


Cheers,


-Luke Clark


Best Answer

Hi Luke


The way you have it working now is fine, there is no real benefit of using the SparkCache for something that can be used within a module. Modules are already cached, the SparkCache is more for storing state rather than functions.


Thanks,

Liam

1 Comment

Answer

Hi Luke


The way you have it working now is fine, there is no real benefit of using the SparkCache for something that can be used within a module. Modules are already cached, the SparkCache is more for storing state rather than functions.


Thanks,

Liam

Login to post a comment