diff --git a/core/core.api.php b/core/core.api.php index 23be3cf976..d86cafb2e6 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -612,11 +612,23 @@ * $settings['database_cache_max_rows']['default'] = 50000; * @endcode * - * Or per bin (in this case removing the maximum): + * Or per bin (in this case we all infinite entries): * @code * $settings['database_cache_max_rows']['bins']['dynamic_page_cache'] = -1; * @endcode * + * For monitoring reasons it might be useful to figure out the amount of data + * stored in tables. The following SQL snippet can be used for that: + * @code + * SELECT table_name AS `Table`, TABLE_ROWS as 'Num. of Rows', + * round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` FROM + * information_schema.TABLES where table_schema = '***DATABASE_NAME***' and + * table_name LIKE 'cache_%' ORDER BY (data_length + index_length) DESC + * limit 10; + * @encode + * + * @see \Drupal\Core\Cache\DatabaseBackend + * * Finally, you can chain multiple cache backends together, see * \Drupal\Core\Cache\ChainedFastBackend and \Drupal\Core\Cache\BackendChain. * diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index 7860ed03fb..6b99a14ec5 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -18,6 +18,11 @@ class DatabaseBackend implements CacheBackendInterface { /** * The default maximum number of rows that this cache bin table can store. + * + * This maximum is introduced to ensure that the database is not filled with + * hundred of thousand of cache entries with gigabytes in size. + * + * @see Read more how to change it at the cache paragraph in core.api.php. */ const DEFAULT_MAX_ROWS = 5000;