'tmsq' -- "tmsu files" query cacher

8 views
Skip to first unread message

D Gowers

unread,
Nov 22, 2014, 5:47:54 AM11/22/14
to tm...@googlegroups.com
Hi,

I wrote this today, finally.

It's a wrapper for 'tmsu files' which remembers your query results for N minutes (default 30), and returns them quickly when you ask for them the second,..Nth time.

Example usage is just like `tmsu files`:

`tmsq banana not apple`

and supports all `tmsu files` options as well as the overall tmsu options TMSU_DB, -D/--database, -v/--verbose, and a few others -- --clean-cache, --list-cached and -o/--cache-timeout


Mostly useful for queries that take a while to execute (eg. complex queries, or queries with large numbers of results) and do not need to be up-to-the-second accurate. If you have a small database, you probably won't gain much from this.
I wrote it because my database is large enough that some queries take 20 - 149 seconds, whereas returning the cached results takes 0.1-0.3 seconds.

Known issues:
  * Commandline help doesn't indicate the remaining arguments (ones that will be passed to 'tmsu files')
  * bad arguments (eg --some-nonsense-option) get treated as part of the 'tmsu files' arguments.
    Not really avoidable, just something to be aware of.
    In this case tmsu files should return no files and you just get an empty cache entry.
  * No Zsh completion. Would be a fairly simple modification of the 'tmsu files' completion code included as part of the TMSU distribution, once I understand how that works.
  * It may be worthwhile to take over the -c/--count option to tmsu files -- certainly significantly faster than treating --count and non --count as different queries. Maybe the same holds true for -0.


For now, it's hosted on bpaste. If anyone aside from me finds it useful, I'll put it up on gitorious.
Enjoy.

Paul Ruane

unread,
Nov 23, 2014, 10:55:28 AM11/23/14
to tm...@googlegroups.com

Hi,

Great idea. I'll take a look. It might be something I can incorporate into the TMSU proper at some point. Certainly then if be able to invalidate the cache when the database changes, &c.

Thanks for contributing this.

Paul


--
You received this message because you are subscribed to the Google Groups "tmsu" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmsu+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Samuel Loury

unread,
Nov 24, 2014, 4:54:00 AM11/24/14
to Paul Ruane, tm...@googlegroups.com
Hi,
Paul Ruane <pa...@tmsu.org> writes:

> Great idea. I'll take a look. It might be something I can incorporate into
> the TMSU proper at some point. Certainly then if be able to invalidate the
> cache when the database changes, &c.

This reminds me of the possibility to provide python wrappers to
interact with tmsu (instead of calling tmsu and using sqlite).

Paul, did you have time to investigate the question?

--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
signature.asc

Paul Ruane

unread,
Nov 24, 2014, 4:58:51 AM11/24/14
to Samuel Loury, Paul Ruane, tm...@googlegroups.com
Hi,

It's on my TODO list: https://bitbucket.org/oniony/tmsu/wiki/TODO.

I want to push out 0.5.0 in the next few weeks then I will look at it as a refactoring exercise for the first item in 0.6.

Thanks for your patience!

Paul
Reply all
Reply to author
Forward
0 new messages