Comments (8)
This feature is currently on-hold, until Toggl finalize their new API version (v9
), which is currently in development (their web client is already using it), but is still not in stable form.
from toggl-cli.
While wanting to do some analysis over all my entries (~2k by now), I've tried using Python's built-in @lru_cache
decorator on the api.others.toggl
function: it seems to work pretty well, will submit a PR soon.
Main issues for proper inclusion into the probject would be:
- when to automatically reset the cache in more interactive use
- how to enable clearing through the cli
- whether to enable by default (as it can be confusing if people don't expect it...)
Any thoughts on these?
from toggl-cli.
That is cool! Somehow I did not think of using @lru_cache
directly. I guess it can actually work!
I originally wanted to implement a custom cache in order to use the bulk fetching capabilities of the Toggl's API. I am reluctant to work on that before they will release the new API version, but until then it is definitely a good idea to use at least lru_cache
!
Regarding your points. Clearing for CLI is not really necessary, because to my knowledge lru_cache
is a memory only, hence when the CLI process will die, the cache will disappear too. Hence a bigger problem will be with long-running projects...
I would add a new property to utils.Config
which will enable/disable usage of caching. Maybe we could use logic to enable caching by default for CLI, but for using the API wrappers it would be by default turned off? What do you think?
Also, I would document that with mentioning that you can clear the cache using api.others.toggl.cache_clear()
call.
Thanks for the idea!
from toggl-cli.
Clearing the cache would still be useful if I e.g. fetch a project, update it and then fetch it again (directly or indirectly). In that case, the old version will still be cached, even though I just updated it. Any update call could then clear the cache to force remote updates without having to check anything.
So I think I would enable it by default for both, but allow changing the cache size through the .togglrc file, where setting it to 0 should disable it I think.
from toggl-cli.
Hmm, by your example you are pointing to CLI usage? Or generally? It is definitely a valid case for the API Wrappers but not really for CLI...
Yup, updates should clear the cache. lru_cache
unfortunately does not allow you to invalidate specific entries.
Yeah, a configuration of the size of the cache is definitely a good idea, but I would still keep it separate from turning on/off caching. Hence having a general boolean flag for having it turned on/off and then another option for the size of the cache.
from toggl-cli.
Hi,
Any updates on this? I would just like to be able to cache API calls so the list loads faster.
from toggl-cli.
I don't plan to tackle this in any close future. I guess @sjvrijn also does not really work on it anymore.
If you would be interested to work on the PR let me know! It would be most welcome!
from toggl-cli.
I could take a look, although I'm not too familiar with the frameworks used in this project. What needs to happen?
from toggl-cli.
Related Issues (20)
- Test failures
- Some more CLI example, please HOT 1
- Project Add command incorrectly claims created projects are public by default
- CLI should not show entry is running when time entry has stop == start HOT 3
- sum command doesn't respect configured timezone HOT 1
- Option to set task? HOT 4
- Rework CLI completion with new Click 8.0 release HOT 1
- Unable to find user for TimeEntry HOT 1
- Add `--colors=always` option for passing to `click` HOT 2
- Authentication fail on "ls" command -- but works for other commands
- How do I find entries without project? HOT 1
- Install completion to $ZDOTDIR/.zshrc HOT 4
- toggl projects add -n "asd asd" --color 123 HOT 3
- Flag to quickly do `toggl stop -p $TIME; toggl start -s $TIME ...` HOT 3
- API v8 is being deprecated and shut down by toggle HOT 12
- [Feature request] rewrite in javascript HOT 1
- Add `num-entries` option to `ls` HOT 3
- Print entry description on `toggl start`
- Feature Request: Summed Worklogs Grouped by Description HOT 5
- Python 3.12 Support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toggl-cli.