Skip to content

Commit 49d24d1

Browse files
committed
Make tag table information configurable
1 parent 820cf33 commit 49d24d1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Symfony/Component/Cache/Adapter/PdoTagAwareAdapter.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,28 @@ class PdoTagAwareAdapter extends AbstractTagAwareAdapter implements PruneableInt
4242
* cache is actually used.
4343
*
4444
* List of available options:
45-
* * db_table: The name of the table [default: cache_items]
45+
* * db_table: The name of the cache item table [default: cache_items]
4646
* * db_id_col: The column where to store the cache id [default: item_id]
4747
* * db_data_col: The column where to store the cache data [default: item_data]
4848
* * db_lifetime_col: The column where to store the lifetime [default: item_lifetime]
4949
* * db_time_col: The column where to store the timestamp [default: item_time]
5050
* * db_username: The username when lazy-connect [default: '']
5151
* * db_password: The password when lazy-connect [default: '']
5252
* * db_connection_options: An array of driver-specific connection options [default: []]
53+
* * db_tags_table: The name of the tags table [default: cache_tags]
54+
* * db_tags_col: The column where to store the tags [default: item_tag]
55+
* * db_tags_tag_index_name: The index name for the tags column [default: idx_cache_tags_item_tag]
5356
*
5457
* @throws InvalidArgumentException When first argument is not PDO nor Connection nor string
5558
* @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
5659
* @throws InvalidArgumentException When namespace contains invalid characters
5760
*/
5861
public function __construct(#[\SensitiveParameter] \PDO|string $connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], ?MarshallerInterface $marshaller = null)
5962
{
63+
$this->tagsTable = $options['db_tags_table'] ?? $this->tagsTable;
64+
$this->tagCol = $options['db_tags_col'] ?? $this->tagCol;
65+
$this->tagIdxName = $options['db_tags_tag_index_name'] ?? $this->tagIdxName;
66+
6067
$this->init($connOrDsn, $namespace, $defaultLifetime, $options, $marshaller);
6168
}
6269

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy