Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@WaylandAce
Copy link
Contributor

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
License MIT

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.

@carsonbot

This comment has been minimized.

@WaylandAce WaylandAce marked this pull request as ready for review April 16, 2025 13:09
@WaylandAce WaylandAce requested a review from jderusse as a code owner April 16, 2025 13:09
@carsonbot carsonbot added this to the 7.3 milestone Apr 16, 2025
public function __construct(
private \Redis|Relay|RelayCluster|\RedisArray|\RedisCluster|\Predis\ClientInterface $redis,
private float $initialTtl = 300.0,
private array $options = [],
Copy link
Member

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?

Copy link
Contributor Author

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)) {
Copy link
Member

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?

Copy link
Contributor Author

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.

@WaylandAce
Copy link
Contributor Author

@nicolas-grekas can you resolve your comments?
@jderusse please review

@fabpot fabpot modified the milestones: 7.3, 7.4 May 26, 2025
@WaylandAce
Copy link
Contributor Author

Not actual since ^7.2 there are option to pass custom connection to StoreFactory, i.e:
lock.dsn: 'cache.default_redis_provider'

@WaylandAce WaylandAce closed this Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants