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

Implement an SQLite cache #23

Closed
WhyNotHugo opened this issue Apr 18, 2016 · 7 comments
Closed

Implement an SQLite cache #23

WhyNotHugo opened this issue Apr 18, 2016 · 7 comments
Assignees

Comments

@WhyNotHugo
Copy link
Member

Use a cache for:

  • Faster startup times
  • Keeping a proper index of ids to show
  • Simplify filtering/sorting by merely using SQL
@WhyNotHugo WhyNotHugo self-assigned this Apr 18, 2016
@WhyNotHugo WhyNotHugo changed the title Implement an SQL cache Implement an SQLite cache Apr 18, 2016
@WhyNotHugo
Copy link
Member Author

I'm currently working on this, and re-writing the whole model backend, so I'd suggest not doing intensive works in those areas in the meantime.

@untitaker
Copy link
Member

I think it's a bad idea to expose SQL queries.

@WhyNotHugo
Copy link
Member Author

I think it's a bad idea to expose SQL queries.

They will only be used internally. The sorting command and all the cli commands in general will remain the same.

@WhyNotHugo
Copy link
Member Author

I had to dump all this, since I'd not considered recurring events. The rewrite will have to take this into consideration.

@untitaker
Copy link
Member

We now have two caches:

  • A JSON object that maps ids to filenames
  • A pickled dict that caches all .ics files

Can we close this issue?

@WhyNotHugo
Copy link
Member Author

WhyNotHugo commented Jan 24, 2017

The idea behind this is to cache all these fields in a small sqlite db, and simply use SQL to filter (not exposing this to the user, of course). This makes the code on #68 a lot friendlier.

Since we only use these fields in list(), we don't even need to read files themselves (except out-of-date cache) except when edition/viewing a single todo.

Also, it means that we can keep ids valid for much longer times (since we can persist them there too). I'd eventually re-compute them on flush().


Edit: I've actually some work done on this, but since it's not 100%, it's mostly broken. :(

@untitaker
Copy link
Member

Persisting IDs may be a bit annoying because those will eventually become larger, and therefore be harder to type.

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

No branches or pull requests

2 participants