-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Add PDO + Doctrine DBAL adapter #19519
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
bb2dba9
to
6a46b9e
Compare
|
||
private function init($pdoOrDsn, $namespace, $defaultLifetime, array $options) | ||
{ | ||
if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) { |
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.
Wouldn't strpbrk
be more efficient ?
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.
not sure, less readable, and not perf critical code path anyway (run once code) :)
6a46b9e
to
f042580
Compare
ab167dc
to
dcc7915
Compare
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $maxIdLength = 255; |
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.
This anticipates #19521 (esp. https://github.com/symfony/symfony/pull/19521/files#diff-a5185cd58702e8e073786794a423cb27R404)
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.
phpdoc seems useless to me
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.
removed
dcc7915
to
2d73939
Compare
2d73939
to
b26521f
Compare
This now also accepts a Doctrine DBAL Connection. |
b26521f
to
a50b5fa
Compare
@@ -26,6 +26,7 @@ | |||
"require-dev": { | |||
"cache/integration-tests": "dev-master", | |||
"doctrine/cache": "~1.6", | |||
"doctrine/dbal": "~2.4", |
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.
From a "component" point of view, you may add doctrine/dbal
to the suggest
section, what do you think ?
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.
Bof... This would never end: install redis, install apcu, install... etc. No value. Read the doc instead (I'm on it).
11e8765
to
5007996
Compare
@@ -64,7 +64,7 @@ public function getItem($key) | |||
} elseif ('b:0;' === $value = $this->values[$key]) { | |||
$value = false; | |||
} elseif (false === $value = unserialize($value)) { | |||
$value = null; | |||
$this->values[$key] = $value = null; |
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.
isn't this a bugfix which should go separately ?
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.
see #19640
break; | ||
case 'pdo_sqlsrv': | ||
$this->driver = 'sqlsrv'; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will 8000 be displayed to describe this comment to others. Learn more.
what about handling the default case here, for unknown drivers ?
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.
we use only pgsql and sqlsrv, so I'd rather remove all the unused cases than add a default
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.
ok, bad answer :) yet, the adapter doesn't handle other drivers, so we don't care for a default case here
5007996
to
82a0de2
Compare
Thank you @nicolas-grekas. |
This PR was merged into the 3.2-dev branch. Discussion ---------- [Cache] Add PDO + Doctrine DBAL adapter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#6858 This PR adds a PDO adapter for our PSR-6 cache items. The implementation heavily borrows from PdoSessionHandler. Commits ------- 82a0de2 [Cache] Add PDO + Doctrine DBAL adapter
This PR adds a PDO adapter for our PSR-6 cache items. The implementation heavily borrows from PdoSessionHandler.