Skip to content

Create a cache for loaded calendars #62

Description

@wilsonfreitas

Problem

Calendar.load(...) rebuilds calendars on every call, even when the same named source is loaded repeatedly. That now affects packaged calendars as well as the optional provider integrations (PMC/, XCAL/, WORK/).

Refined scope

  1. Add an internal cache for repeated Calendar.load(name=...) calls.
  2. Cover packaged calendars and the existing named providers:
    • ANBIMA, B3, Actual
    • PMC/<calendar>
    • XCAL/<calendar>
    • WORK/<code>
  3. Keep filename=... loads out of the initial cache scope to avoid stale-file invalidation complexity.
  4. Preserve behavior safety: the cache must not leak shared mutable Calendar instances across callers.
  5. Keep the NumPy-backed and legacy loaders aligned.

Acceptance notes

  • Repeated named loads should avoid reparsing or rebuilding from the source.
  • A caller mutating a returned calendar object must not affect later loads.
  • Tests will likely need an internal cache reset helper, but that does not need to be part of the public API.
  • list_calendars() is discovery only; this issue is about load-time reuse.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions