-
Notifications
You must be signed in to change notification settings - Fork 31
refactor: streamline row and column data handling by implementing cac… #1841
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
Conversation
cd1da46
to
14b3e13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AIlkiv thanks also for this PR. Not sure it was yet for review? Did not test but left some remarks, generally looks nice! There is a also a conflict pending.
public function findAll(array $tableColumns, array $columns, int $tableId, ?int $limit = null, ?int $offset = null, ?array $filter = null, ?array $sort = null, ?string $userId = null): array { | ||
$this->setColumns($columns, $tableColumns); | ||
$columnIdsArray = array_map(fn (Column $column) => $column->getId(), $columns); | ||
public function findAll(array $showColumnIds, int $tableId, ?int $limit = null, ?int $offset = null, ?array $filter = null, ?array $sort = null, ?string $userId = null): array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update or remove the phpdoc block above
lib/Db/ColumnMapper.php
Outdated
@@ -19,6 +19,7 @@ | |||
class ColumnMapper extends QBMapper { | |||
protected string $table = 'tables_columns'; | |||
private LoggerInterface $logger; | |||
private array $cacheColumn = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider OCP\Cache\CappedMemoryCache
? We use it in TableMapper
.
lib/Db/ColumnMapper.php
Outdated
public function findMultiple(array $ids): array { | ||
$qb = $this->db->getQueryBuilder(); | ||
$qb->select('*') | ||
->from($this->table) | ||
->where($qb->expr()->in('id', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))); | ||
return $this->findEntities($qb); | ||
return $this->findAll($ids); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might just remove the whole method and/or rename findAll
when it expects a limitation anyway.
9469c35
to
911348c
Compare
@blizzz Thank you for the review. I’ve made the necessary code changes. Please take another look when you have a moment. |
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
…hing and simplifying method signatures Signed-off-by: ailkiv <a.ilkiv.ye@gmail.com>
911348c
to
e761f16
Compare
This PR introduces caching at the ColumnMapper level, which allowed the following improvements:
These changes reduce hidden dependencies and improve code readability.