cli icon indicating copy to clipboard operation
cli copied to clipboard

cache improvements

Open buschNT opened this issue 3 years ago • 0 comments

Feedback from @SteinRobert for my initial cache implementation. In the initial MR this is not considered. We could implement this later on.

Hey @buschNT ! Thank you so much for you great work on the caching (and integrating Gefyra)!

I think most things are pretty much style stuff.

However one main thing is actually missing - in case we're talking about a "cache" the objects stored in the cache need to have some kind of lifetime or timeout.

This concept is pretty much missing which will lead to outdated data in some cases.

I would suggest to implement something like getitem (see this awesome stackoverflow post: https://stackoverflow.com/questions/43627405/understanding-getitem-method). This is combination with a timeout would allow the cache to detect outdated data which needs to be refreshed. It can continue refreshing on its own then.

That's why I mentioned that we need some kind of timeout for the stored data.

File: unikube/cache/base_file_cache.py

I would suggest to add a timeout parameter to the save method. This way you determine how long data is valid when it's written. Otherwise the time of the validity of data could be altered (e.g. through updated cli code). However, the timestamp may still be valuable for debugging purposes.

buschNT avatar May 05 '22 07:05 buschNT