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

perf(laravel): Caching tables and indexes to avoid multiple queries #6744

Open
wants to merge 6 commits into
base: 4.0
Choose a base branch
from

Conversation

amermchaudhary
Copy link
Contributor

Q A
Branch? 4.0
Tickets
License MIT
Doc PR

This PR uses Cache::flexible from Laravel to improve performance so that same table data is not requested multiple times and the request happens in the background

/** @var array<int, mixed> $indexes */
$indexes = Cache::flexible('api-platform.indexes.'.$table, [5, 10], function () use ($schema, $table) {
return $schema->getIndexes($table);
});
Copy link
Member

@soyuka soyuka Oct 24, 2024

Choose a reason for hiding this comment

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

Interesting change, note also #6735. We already have a cache layer so that this isn't called more then once per metadata computation in production mode.

This cache is stored in memory ? File ? How do you make sure it's not stale ?

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.

2 participants