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(cache): add clear cache command #241

Merged
merged 13 commits into from
Jul 8, 2023

Conversation

daaanny90
Copy link
Contributor

Purpose

I faced the problem, that I could not see new project, customer or services while using mite-cli, because those were updated in mite but I was using an old cache.

I find useful to have a command to clear the cache. I don't know the codebase very well, I tried to contribute with the quick solution I build for myself.

Of course, feel free to point me in the right direction and decline the PR if there are other more elegant solutions.

Description of Change

My quick solution was directly to replace the content of the file were the cache is saved with an empty object.

Then, the next time mite new is used, then the cache will be updated with fresh data.

Todos

  • must be cleared if this is really the best solution to achieve it

daaanny90 added 3 commits July 6, 2023 11:10
When the mite data are updated (new projects, customers or services) is useful to clear the cache, in order to get the updated changes. Otherwise also if there are new projects, mite-cli will not show them, until the cache is rebuild with the fresh data from mite.
@daaanny90 daaanny90 changed the title Feat/clear cache feat(cache): add clear cache command Jul 6, 2023
Copy link
Owner

@Ephigenia Ephigenia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Cache class provides a method for "clearing" the cache which can be used here. As the Cache is used by the mite-api this could also be added in the mite-api itself.

@Ephigenia
Copy link
Owner

Thanks for your contribution!

@daaanny90 daaanny90 requested a review from Ephigenia July 7, 2023 10:06
@Ephigenia
Copy link
Owner

I’ve changed some minor things. Will merge it soon.

There also could be a more specific cache.clear function that could be called from the "customer-new" command or similar to clear the cache automatically when the cached data is changed by a mite-cli command.

@Ephigenia Ephigenia merged commit 007a2c3 into Ephigenia:master Jul 8, 2023
github-actions bot pushed a commit that referenced this pull request Jul 8, 2023
# [1.11.0](v1.10.4...v1.11.0) (2023-07-08)

### Features

* **cache:** add clear cache command ([#241](#241)) ([007a2c3](007a2c3))
@github-actions
Copy link

github-actions bot commented Jul 8, 2023

🎉 This PR is included in version 1.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants