Skip to content

Add StaticCache::remember() #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 12, 2025
Merged

Add StaticCache::remember() #94

merged 3 commits into from
Jul 12, 2025

Conversation

onairmarc
Copy link
Member

No description provided.

@onairmarc onairmarc requested a review from Copilot July 12, 2025 12:58
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new remember() method to the StaticCache class for running and caching closure results.

  • Imports Closure and defines StaticCache::remember()
  • Lazily computes, stores, and retrieves values, respecting the disabled cache flag
Files not reviewed (1)
  • .idea/php.xml: Language not supported
Comments suppressed due to low confidence (2)

src/Objects/Support/StaticCache.php:70

  • Consider adding a PHPDoc block for remember() to document parameter types, return type, and describe its caching behavior, including handling of disabled cache and partition logic.
    public static function remember(BackedEnum|string $key, Closure $value, BackedEnum|string $partition = "default"): mixed

src/Objects/Support/StaticCache.php:70

  • Add unit tests covering remember()’s cache miss, cache hit, and disabled-cache paths to ensure each branch works correctly.
    public static function remember(BackedEnum|string $key, Closure $value, BackedEnum|string $partition = "default"): mixed

@onairmarc onairmarc force-pushed the static-cache-remember branch from 7e7abfd to 43a07b5 Compare July 12, 2025 13:00
@onairmarc onairmarc merged commit fa069a8 into main Jul 12, 2025
1 check passed
@onairmarc onairmarc deleted the static-cache-remember branch July 12, 2025 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant