14 Commits

Author SHA1 Message Date
Till Krüss 581c5659bd update year in headers 2026-02-23 11:48:06 -08:00
Till Krüss ba66e22c92 bump year to 2025 2025-01-22 09:24:26 -08:00
Till Krüss 7631d317fd update year 2024-11-21 11:37:10 -08:00
Till Krüss 47a7cbc862 unify code formatting 2023-01-17 15:08:18 -08:00
Till Krüss cc40219268 use short array syntax 2023-01-17 15:08:18 -08:00
Till Krüss c9babb1984 update copyright comments 2023-01-17 13:41:35 -08:00
Daniele Alessandri 36c9bb047e [tests] Start improving test suite.
- Make use of more typehints for function parameters
- Make use of typehints for function return values
- Use @var where needed to give proper hints to IDEs and avoid warnings
- Replace MockObject::setMethods() with addMethods() and onlyMethods()
- Rewording of some phpdocs
2020-09-01 13:58:14 +02:00
Raza Mehdi 5edf443141 Fix tests. 2020-08-16 01:59:41 +05:00
Daniele Alessandri 6590c44a27 Run php-cs-fixer against codebase in src/ and tests/. 2015-07-24 18:04:42 +02:00
Daniele Alessandri 45e351be79 [phpdoc] Fix formatting of phpdoc headers. 2014-07-27 23:59:37 +02:00
Daniele Alessandri aa5c893d5a [phpdoc] Fix undefined namespaces. 2014-07-27 21:57:40 +02:00
Daniele Alessandri 2ff8c37104 Redesign the whole internals for clustering.
This change actually had a positive impact on the design of the whole
internals for clustering which is now cleaner and easier to maintain.
It is still far from perfect, but we also have to keep performances in
consideration so we can say that we ended up with a good compromise.

Previously Predis assigned an hash to each command instance which was
computed from its key, now we changed approach and the library caches
the slot assigned to each command. This works for both our client-side
sharding cluster and the upcoming redis-cluster, but the former is the
one that needed most changes.

The PredisCluster aggregate connection now only takes an instance of
StrategyInterface, which in turn wraps the chosen distributor. After
all, in order to be able to calculate the assigned slot for a command
or key, the cluster strategy must have access to the distributor that
manages the distribution of the whole keyspace. Nothing really changes
in terms of configurability as it is still possible to decide which
distributor to use for client-side sharding, it is simply different:

  $distributor = new Predis\Cluster\Distribution\KetamaRing();
  $strategy = new Predis\Cluster\PredisStrategy($distributor);
  $cluster = new Predis\Connection\Aggregate\PredisCluster($strategy);

As for the RedisCluster aggregate connection, the only change is that
the mathematical operation of calculating the assigned slot from a key
has been completely moved inside the cluster strategy instance.

The strategy for redis-cluster does not use external distributors so
trying to StrategyInterface::getDistributor() will throw an exception.
This may change in future releases, but this is not a priority since
redis-cluster relies on a fixed, well-defined distribution mechanism.
2014-07-22 18:13:12 +02:00
Daniele Alessandri 2a6409590c Run php-cs against test suite. 2013-12-17 12:55:56 +01:00
Daniele Alessandri d2c001812f [tests] Rename test case classes. 2013-12-01 15:11:09 +01:00