Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop

jobs:
test:
name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
name: PHP${{ matrix.php-versions }} | Redis${{ matrix.redis-versions }} on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1', '8.2', '8.3']
redis-versions: ['6.0']
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4']
redis-versions: ['6.2', '7.4', '8.0']

steps:
- name: Checkout
Expand Down Expand Up @@ -47,7 +49,7 @@ jobs:
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Cache composer dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require": {
"php": ">=8.0.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"psr/simple-cache": "^1.0",
"psr/simple-cache": "^2.0 || ^3.0",
"cheprasov/php-redis-client": "^1.10"
},
"require-dev": {
Expand Down
20 changes: 7 additions & 13 deletions src/SimpleCacheAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Vectorface\Cache;

use Psr\SimpleCache\CacheInterface;
use Traversable;

/**
* Adapts a Vectorface cache instance to the PSR SimpleCache interface.
Expand All @@ -12,8 +11,6 @@ class SimpleCacheAdapter implements CacheInterface
{
/**
* Create an adapter over a Vectorface cache instance to the SimpleCache interface.
*
* @param Cache $cache
*/
public function __construct(
protected Cache $cache,
Expand All @@ -22,7 +19,7 @@ public function __construct(
/**
* @inheritDoc
*/
public function get($key, $default = null)
public function get(string $key, mixed $default = null): mixed
{
return $this->cache->get($key, $default);
}
Expand All @@ -31,15 +28,15 @@ public function get($key, $default = null)
* @inheritDoc
* @throws Exception\CacheException
*/
public function set($key, $value, $ttl = null) : bool
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool
{
return $this->cache->set($key, $value, $ttl);
}

/**
* @inheritDoc
*/
public function delete($key) : bool
public function delete(string $key): bool
{
return $this->cache->delete($key);
}
Expand All @@ -54,36 +51,33 @@ public function clear() : bool

/**
* @inheritDoc
* @param array|Traversable $keys
*/
public function getMultiple($keys, $default = null) : iterable
public function getMultiple(iterable $keys, mixed $default = null): iterable
{
return $this->cache->getMultiple($keys, $default);
}

/**
* @inheritDoc
* @param array|Traversable $values
* @throws Exception\CacheException
*/
public function setMultiple($values, $ttl = null) : bool
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool
{
return $this->cache->setMultiple($values, $ttl);
}

/**
* @inheritDoc
* @param array|Traversable $keys
*/
public function deleteMultiple($keys) : bool
public function deleteMultiple(iterable $keys): bool
{
return $this->cache->deleteMultiple($keys);
}

/**
* @inheritDoc
*/
public function has($key) : bool
public function has(string $key): bool
{
return $this->cache->has($key);
}
Expand Down
Loading