Skip to content

Commit

Permalink
Merge pull request #100 from boesing/refactor/redis-resource-manager
Browse files Browse the repository at this point in the history
`RedisResourceManager` refactoring
  • Loading branch information
boesing committed Jun 21, 2024
2 parents a3492b3 + 640af62 commit 573ba3b
Show file tree
Hide file tree
Showing 45 changed files with 1,332 additions and 1,828 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/test/ export-ignore
/benchmark/ export-ignore
/phpbench.json export-ignore
/psalm export-ignore
11 changes: 1 addition & 10 deletions .laminas-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,5 @@
"redis.clusters.timeout = 'cluster=5'",
"redis.clusters.read_timeout = 'cluster=10'"
],
"additional_checks": [
{
"name": "Run tests on ext-redis 5.3.7",
"job": {
"php": "*",
"dependencies": "locked",
"command": "REDIS_VERSION=5.3.7 vendor/bin/phpunit"
}
}
]
"backwardCompatibilityCheck": true
}
19 changes: 9 additions & 10 deletions benchmark/RedisClusterStorageAdapterBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
namespace LaminasBench\Cache;

use Laminas\Cache\Storage\Adapter\Benchmark\AbstractStorageAdapterBenchmark;
use Laminas\Cache\Storage\Adapter\RedisClusterOptions;
use LaminasTest\Cache\Storage\Adapter\Laminas\RedisClusterStorageCreationTrait;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use Redis;

/**
* @Revs(100)
* @Iterations(10)
* @Warmup(1)
* @template-extends AbstractStorageAdapterBenchmark<RedisClusterOptions>
*/
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisClusterStorageAdapterBench extends AbstractStorageAdapterBenchmark
{
use RedisClusterStorageCreationTrait;

public function __construct()
{
parent::__construct($this->createRedisClusterStorage(
Redis::SERIALIZER_NONE,
true
));
parent::__construct($this->createRedisClusterStorage(Redis::SERIALIZER_NONE, true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
namespace LaminasBench\Cache;

use Laminas\Cache\Storage\Adapter\Benchmark\AbstractStorageAdapterBenchmark;
use Laminas\Cache\Storage\Adapter\RedisClusterOptions;
use LaminasTest\Cache\Storage\Adapter\Laminas\RedisClusterStorageCreationTrait;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use Redis;

/**
* @Revs(100)
* @Iterations(10)
* @Warmup(1)
* @template-extends AbstractStorageAdapterBenchmark<RedisClusterOptions>
*/
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisClusterWithIgbinarySerializerStorageAdapterBench extends AbstractStorageAdapterBenchmark
{
use RedisClusterStorageCreationTrait;

public function __construct()
{
parent::__construct($this->createRedisClusterStorage(
Redis::SERIALIZER_IGBINARY,
false
));
parent::__construct($this->createRedisClusterStorage(Redis::SERIALIZER_IGBINARY, false));
}
}
19 changes: 9 additions & 10 deletions benchmark/RedisClusterWithPhpSerializerStorageAdapterBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
namespace LaminasBench\Cache;

use Laminas\Cache\Storage\Adapter\Benchmark\AbstractStorageAdapterBenchmark;
use Laminas\Cache\Storage\Adapter\RedisClusterOptions;
use LaminasTest\Cache\Storage\Adapter\Laminas\RedisClusterStorageCreationTrait;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use Redis;

/**
* @Revs(100)
* @Iterations(10)
* @Warmup(1)
* @template-extends AbstractStorageAdapterBenchmark<RedisClusterOptions>
*/
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisClusterWithPhpSerializerStorageAdapterBench extends AbstractStorageAdapterBenchmark
{
use RedisClusterStorageCreationTrait;

public function __construct()
{
parent::__construct($this->createRedisClusterStorage(
Redis::SERIALIZER_PHP,
false
));
parent::__construct($this->createRedisClusterStorage(Redis::SERIALIZER_PHP, false));
}
}
19 changes: 9 additions & 10 deletions benchmark/RedisStorageAdapterBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
namespace LaminasBench\Cache;

use Laminas\Cache\Storage\Adapter\Benchmark\AbstractStorageAdapterBenchmark;
use Laminas\Cache\Storage\Adapter\RedisOptions;
use LaminasTest\Cache\Storage\Adapter\Laminas\RedisStorageCreationTrait;
use PhpBench\Benchmark\Metadata\Annotations\Iterations;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
use PhpBench\Benchmark\Metadata\Annotations\Warmup;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use Redis;

/**
* @Revs(100)
* @Iterations(10)
* @Warmup(1)
* @template-extends AbstractStorageAdapterBenchmark<RedisOptions>
*/
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisStorageAdapterBench extends AbstractStorageAdapterBenchmark
{
use RedisStorageCreationTrait;

public function __construct()
{
parent::__construct($this->createRedisStorage(
Redis::SERIALIZER_NONE,
true
));
parent::__construct($this->createRedisStorage(Redis::SERIALIZER_NONE, true));
}
}
29 changes: 29 additions & 0 deletions benchmark/RedisWithIgbinarySerializerStorageAdapterBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace LaminasBench\Cache;

use Laminas\Cache\Storage\Adapter\Benchmark\AbstractStorageAdapterBenchmark;
use Laminas\Cache\Storage\Adapter\RedisOptions;
use LaminasTest\Cache\Storage\Adapter\Laminas\RedisStorageCreationTrait;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use Redis;

/**
* @template-extends AbstractStorageAdapterBenchmark<RedisOptions>
*/
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisWithIgbinarySerializerStorageAdapterBench extends AbstractStorageAdapterBenchmark
{
use RedisStorageCreationTrait;

public function __construct()
{
parent::__construct($this->createRedisStorage(Redis::SERIALIZER_IGBINARY, false));
}
}
29 changes: 29 additions & 0 deletions benchmark/RedisWithPhpSerializerStorageAdapterBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace LaminasBench\Cache;

use Laminas\Cache\Storage\Adapter\Benchmark\AbstractStorageAdapterBenchmark;
use Laminas\Cache\Storage\Adapter\RedisOptions;
use LaminasTest\Cache\Storage\Adapter\Laminas\RedisStorageCreationTrait;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use Redis;

/**
* @template-extends AbstractStorageAdapterBenchmark<RedisOptions>
*/
#[Revs(100)]
#[Iterations(10)]
#[Warmup(1)]
class RedisWithPhpSerializerStorageAdapterBench extends AbstractStorageAdapterBenchmark
{
use RedisStorageCreationTrait;

public function __construct()
{
parent::__construct($this->createRedisStorage(Redis::SERIALIZER_PHP, false));
}
}
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
"license": "BSD-3-Clause",
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"ext-redis": "^5.3.2 || ^6.0",
"ext-redis": "^6.0",
"laminas/laminas-cache": "^4.0"
},
"provide": {
"laminas/laminas-cache-storage-implementation": "2.0"
},
"require-dev": {
"laminas/laminas-cache": "4.0.x-dev || ^4.0",
"laminas/laminas-cache-storage-adapter-benchmark": "2.0.x-dev || ^2.0",
"laminas/laminas-cache-storage-adapter-test": "3.0.x-dev || ^3.0",
"laminas/laminas-cache-storage-adapter-benchmark": "^2.1",
"laminas/laminas-cache-storage-adapter-test": "^4.0.1",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-serializer": "^3.0",
"psalm/plugin-phpunit": "^0.19.0",
Expand Down
Loading

0 comments on commit 573ba3b

Please sign in to comment.