Skip to content

Efficiently wipe disk cache when many items are too old #186

Open

Description

@bkase

Cache clearing via the ageLimit can be too slow when too many items expire all at once. This can hurt app-startup performance. As far as I understand it, this is slow because we check file timestamps and remove files one at a time. Removing directories is faster than removing files so if there were some way that the disk cache could optimize this to remove directories.

Random ideas:

  1. Persist the "oldest" timestamp and do a quick check in the beginning to just wipe the full directory. Downside: Must wipe entire cache.

  2. Add layer(s) of inner directories grouped by some time interval. Then we can wipe huge chunks of the cache efficiently. The semantics of how this could work exactly need more looking into. Downside: Invalidates caches for existing users, and is complex.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions