Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimization of read operations #8

Closed
lopezjuanma96 opened this issue Oct 17, 2022 · 1 comment
Closed

optimization of read operations #8

lopezjuanma96 opened this issue Oct 17, 2022 · 1 comment

Comments

@lopezjuanma96
Copy link
Contributor

lopezjuanma96 commented Oct 17, 2022

one way to optimize the process, which is actually already pretty fast, is to store variables with data from firebase somewhere they can be accessed if needed.
Like a middle point between calling them on every function:

function1(args) {
   const data = ref('db').get()
}
function2(args) {
   const data = ref('db').get()
}

and carrying them from the first function to the last one as parameters:

superfunction(argsFunc1, argsFunc2){
    const data = ref('db').get();
    function1(argsFunc1, data);
    function2(argsFunc2, data);
}
 function1(args, data) {
   const data = ref('db').get()
}
function2(args, data) {
   const data = ref('db').get()
}

maybe this can be done with a singleton that handles the variables and gets them from db only if they haven't been requested before (on that execution, obviously after the execution is done, data would be erased, but at least it's not local to each function)

@lopezjuanma96
Copy link
Contributor Author

created class dbGetter with static properties and methods (singleton) to get data if it hasn't been already retrieved before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant