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

✨ feat(config.ts): add caching mechanism to reduce file I/O operations #166

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

takuya-o
Copy link
Contributor

@takuya-o takuya-o commented May 6, 2023

A caching mechanism has been added to the getConfig function to improve performance by reducing the number of file I/O operations. The function now checks if the configCache variable is enabled and returns the cached value if it is. If the cache is not enabled, the function reads the configuration file and returns the value. After reading the configuration file, the function stores the value in the cache for future use.

@di-sukharev
Copy link
Owner

that's a great idea, but opencommit runs as a script which exits the process when done, so all the variables are lost :)

@takuya-o
Copy link
Contributor Author

takuya-o commented May 7, 2023

that's a great idea, but opencommit runs as a script which exits the process when done, so all the variables are lost :)

In a single process launch, getConfig() is called multiple times and the .opencommit file is read multiple times unnecessarily.
@di-sukharev I think that it should be read only once in the process.

@di-sukharev
Copy link
Owner

@takuya-o ohh you are right, could you solve the conflict pls and lets merge

A caching mechanism has been added to the getConfig function to improve performance by reducing the number of file I/O operations. The function now checks if the configCache variable is enabled and returns the cached value if it is. If the cache is not enabled, the function reads the configuration file and returns the value. After reading the configuration file, the function stores the value in the cache for future use.
@takuya-o
Copy link
Contributor Author

@takuya-o ohh you are right, could you solve the conflict pls and lets merge

@di-sukharev I did solve the conflict. Could you merge this?

@github-actions
Copy link

github-actions bot commented Jul 8, 2023

Stale pull request message

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

Successfully merging this pull request may close these issues.

None yet

2 participants