Skip to content

cache get should extend expiration  #31

Closed
@paddlesteamer

Description

If the requested item expires between get and set, the file would be unreachable.
https://github.com/paddlesteamer/hdn-drv/blob/b7e487b49f40fe1a2c5839ee85f46a4d313f9c3a/internal/manager/manager.go#L211-L222

Low probability but can happen. Unfortunately go-cache doesn't support atomic operation for this. There is a PR though:
patrickmn/go-cache#96 but it doesn't look completely safe.

So we can implement that ourselves or risk it and use the code in the PR.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions