sonata-project/SonataDatagridBundle

Cache pager results

core23 opened this issue · 2 comments

Environment

Sonata packages

sonata-project/admin-bundle              3.x-dev 54119cf    The missing Symfony Admin Generator
sonata-project/block-bundle              3.3.1              Symfony SonataBlockBundle
sonata-project/cache                     1.0.7              Cache library
sonata-project/cache-bundle              2.3.1              This bundle provides caching services
sonata-project/classification-bundle     3.2.1              Symfony SonataClassificationBundle
sonata-project/core-bundle               3.x-dev a4ef3ad    Symfony SonataCoreBundle
sonata-project/dashboard-bundle          dev-master 2f81632 Provides a Dashboard management through container and block services
sonata-project/datagrid-bundle           2.2.1              Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.x-dev 674fbad    Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.1.10             Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.7.1              Lightweight Exporter library
sonata-project/formatter-bundle          3.2.0              Symfony SonataFormatterBundle
sonata-project/google-authenticator      1.0.2              Library to integrate Google Authenticator into a PHP project
sonata-project/intl-bundle               2.3.0              Symfony SonataIntlBundle
sonata-project/media-bundle              3.4.0              Symfony SonataMediaBundle
sonata-project/news-bundle               3.1.1              Symfony SonataNewsBundle
sonata-project/notification-bundle       3.1.0              Symfony SonataNotificationBundle
sonata-project/page-bundle               3.x-dev b360b6c    This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle                2.x-dev 7288c8b    Symfony SonataSeoBundle
sonata-project/timeline-bundle           3.1.0              Integrates SpyTimelineBundle into Sonata
sonata-project/user-bundle               3.2.1              Symfony SonataUserBundle

Symfony packages

symfony/asset                v3.0.9  Symfony Asset Component
symfony/assetic-bundle       v2.8.1  Integrates Assetic into Symfony2
symfony/cache                v3.2.4  Symfony implementation of PSR-6
symfony/class-loader         v2.8.17 Symfony ClassLoader Component
symfony/config               v2.8.17 Symfony Config Component
symfony/console              v2.8.17 Symfony Console Component
symfony/css-selector         v3.2.4  Symfony CssSelector Component
symfony/debug                v2.8.17 Symfony Debug Component
symfony/debug-bundle         v3.1.10 Symfony DebugBundle
symfony/dependency-injection v2.8.17 Symfony DependencyInjection Component
symfony/doctrine-bridge      v3.2.4  Symfony Doctrine Bridge
symfony/dom-crawler          v3.2.4  Symfony DomCrawler Component
symfony/event-dispatcher     v3.0.9  Symfony EventDispatcher Component
symfony/expression-language  v3.2.4  Symfony ExpressionLanguage Component
symfony/filesystem           v3.0.9  Symfony Filesystem Component
symfony/finder               v2.8.17 Symfony Finder Component
symfony/form                 v2.8.17 Symfony Form Component
symfony/framework-bundle     v2.8.17 Symfony FrameworkBundle
symfony/http-foundation      v2.8.17 Symfony HttpFoundation Component
symfony/http-kernel          v2.8.17 Symfony HttpKernel Component
symfony/intl                 v2.8.17 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/locale               v2.8.17 Symfony Locale Component
symfony/monolog-bridge       v3.2.4  Symfony Monolog Bridge
symfony/monolog-bundle       v3.0.3  Symfony MonologBundle
symfony/options-resolver     v2.8.17 Symfony OptionsResolver Component
symfony/phpunit-bridge       v3.2.4  Symfony PHPUnit Bridge
symfony/polyfill-apcu        v1.3.0  Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu    v1.3.0  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring    v1.3.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php54       v1.3.0  Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions
symfony/polyfill-php55       v1.3.0  Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions
symfony/polyfill-php56       v1.3.0  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70       v1.3.0  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util        v1.3.0  Symfony utilities for portability of PHP codes
symfony/process              v2.8.17 Symfony Process Component
symfony/property-access      v3.0.9  Symfony PropertyAccess Component
symfony/routing              v2.8.17 Symfony Routing Component
symfony/security             v2.8.17 Symfony Security Component
symfony/security-acl         v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle      v2.8.17 Symfony SecurityBundle
symfony/stopwatch            v3.0.9  Symfony Stopwatch Component
symfony/swiftmailer-bundle   v2.5.3  Symfony SwiftmailerBundle
symfony/templating           v2.8.17 Symfony Templating Component
symfony/translation          v2.8.17 Symfony Translation Component
symfony/twig-bridge          v2.8.17 Symfony Twig Bridge
symfony/twig-bundle          v3.1.10 Symfony TwigBundle
symfony/validator            v2.8.17 Symfony Validator Component
symfony/var-dumper           v3.2.4  Symfony mechanism for exploring and dumping PHP variables
symfony/web-profiler-bundle  v2.8.17 Symfony WebProfilerBundle
symfony/yaml                 v3.2.4  Symfony Yaml Component

PHP version

PHP 7.0.14 (cli) 

Subject

There is no caching for the getResults method which is a big performance issue.

Steps to reproduce

When using the Doctrine\Pager class and calling getResults several times in the template, a query is execute each time

Expected results

The query is executed once.

Actual results

The query is executed every time.

stale commented

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

I'm not sure if this is just a dev problem. In production you should use caching for doctrine.