Skip to content
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

All Caches should implement CacheInterface, any maybe CacheTrait #105

Closed
tacman opened this issue Mar 6, 2024 · 4 comments
Closed

All Caches should implement CacheInterface, any maybe CacheTrait #105

tacman opened this issue Mar 6, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tacman
Copy link
Contributor

tacman commented Mar 6, 2024

Description

I'm working on the debug toolbar, and I'd like to display a table of the caches.

All of them implement some similar properties, having them implement an interface would make them easy to find.

We could add getters to a trait, too. No compelling reason yet to do so, but maybe someday.

Example

        foreach ($this->getWorkbox() as $var=>$val) {
            if (is_object($val)) {
                $name = $val::class;
                if (str_ends_with($name, 'Cache')) {
                    $cache[] = (array)$val + ['name' => (new \ReflectionClass($name))->getShortName()];
                }
            }
        }

Rather than checking if the class ends in Cache, I'd rather check for an interface.

Final result I think will be helpful

image

@Spomky
Copy link
Member

Spomky commented Mar 6, 2024

That's really nice!
OK for a CacheInterface. at least with the name and strategy.
It could be more generic in the future.

@Spomky Spomky self-assigned this Mar 6, 2024
@Spomky Spomky added the enhancement New feature or request label Mar 6, 2024
@Spomky Spomky added this to the 1.1.0 milestone Mar 6, 2024
@tacman
Copy link
Contributor Author

tacman commented Mar 6, 2024

Thanks! I'm going to add more to the toolbar today (e.g. manifest).

I see the different caches, but I don't see the Cache Strategy. Am I missing something?

@Spomky
Copy link
Member

Spomky commented Mar 9, 2024

Resolved the the HasCacheStratigies interface.

@Spomky Spomky closed this as completed Mar 9, 2024
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants