Skip to content

Completions caching #6

@mriehl

Description

@mriehl

The oracle databases I currently work with unfortunately have a ton of namespaces and tables.
This results in "Refreshing completions" for around a minute every time I start okcli.

I've talked a bit with @icepuma about this issue and we had the idea to add optional completion caching to okcli.
It could work like this:

  • entirely opt-in and set by command line flag (eG --enable-completions-cache or similar)
  • if enabled, the completions are serialized into the XDG_CACHE_DIR
  • if enabled and there is a completions dump at start, deserialize from file instead of asking the DB
  • if disabled, nothing changes

The cache would be per-connection, for example after hashing the connection string.
I don't have any particular preference regarding cache invalidation, maybe simply removing the file manually would be good enough for a first start, or a --force-invalidate-cache option (slightly better especially if the file name is a hash).

A slightly easier variation to avoid dealing with XDG would be to simply support --completion-cache <path> so the user can decide if and when to delete the file. But it also introduces the potential mistake of using a completion cache for a different connection which would be confusing.

What are your thoughts on this and would you accept a pull request implementing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions