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

Allow for caching of widgets #421

Merged
merged 7 commits into from
May 10, 2019
Merged

Allow for caching of widgets #421

merged 7 commits into from
May 10, 2019

Conversation

bobdenotter
Copy link
Member

Makes a big difference, especially for widgets like 'news'...

Before:

Screenshot 2019-05-09 at 22 02 39

After:

Screenshot 2019-05-09 at 22 02 54

$this->key = $this->createKey();
}

public function cachedInvoke(): string
Copy link
Member

Choose a reason for hiding this comment

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

can't this method just overwrite __invoke() ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to try something else to make it more elegant.

Overriding it would be nice, but won't work in this case. A trait can override methods from the base (extended) class, but then there's no such thing as a ::parent.

src/Widget/CacheAware.php Outdated Show resolved Hide resolved
src/Widget/SnippetWidget.php Outdated Show resolved Hide resolved
@bobdenotter bobdenotter added this to the Bolt 4 beta 1 milestone May 10, 2019
@bobdenotter bobdenotter merged commit c844cc0 into master May 10, 2019
@bobdenotter bobdenotter deleted the fix/cache-widgets branch May 10, 2019 17:16
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.

None yet

2 participants