Skip to content

Postpone side effect on Fanout cache instantiation #379

Open

Description

@stefanoborini

Currently, the FanoutCache init method invokes mkdtemp, which creates the directory as a side effect.

In a module that defines FanoutCache() at the module level to then use it with decorator memoize, importing this module will perform the temporary directory creation as a side effect on import, something that can be a problem in some contexts (e.g. testing)

The request would be to delay directory creation and shard definition until the first use of the caching or any other directory needing method or property, and only then create the directory, so that module import would not perform the side effect. This can be optional (e.g with a flag on constructor)

Activity

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

Metadata

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