-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Lock] Add namespace support to Redis & Memcache lock stores #60227
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
base: 7.3
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
*/ | ||
public function __construct( | ||
private \Redis|Relay|RelayCluster|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis, | ||
private float $initialTtl = 300.0, | ||
private array $options = [], |
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.
why use an array of options rather than give the namespace directly?
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.
I prefer to use namespace parameter directly, but I tried to keep style similar to other stores (DoctrineDbalStore, MongoDbStore, PdoStore, PostgreSqlStore)
|
||
$matches = []; | ||
$namespace = ''; | ||
if (preg_match('/^(.*[\?&])namespace=([^&#]*)&?(([^#]*).*)$/', $connection, $matches)) { |
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.
can't we use parse_url instead of this logic?
also, don't we need something similar on MemcachedStore?
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.
It's general to both stores (StoreFactory class).
parse_url cant be used here, because redis dsn string is not always URL format compatible. Also this approach is used in MongoDbStore (collection paramerer), with "options" array as well.
4994f37
to
788c1c1
Compare
Sometimes we need use shared redis cluster between applications. By security reasons we allow each application to access only own keys. Cache component can deal with it, lock - is not.