Skip to content

Commit f9ce66e

Browse files
committed
Cache: Rename CacheStoreInterface to CacheInterface
1 parent 1b11fc7 commit f9ce66e

File tree

9 files changed

+41
-41
lines changed

9 files changed

+41
-41
lines changed

scripts/generate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Salient\Cli\CliOptionBuilder;
99
use Salient\Console\ConsoleWriter;
1010
use Salient\Container\Container;
11-
use Salient\Contract\Cache\CacheStoreInterface;
11+
use Salient\Contract\Cache\CacheInterface;
1212
use Salient\Contract\Console\ConsoleWriterInterface;
1313
use Salient\Contract\Container\ContainerInterface;
1414
use Salient\Contract\Core\MessageLevel as Level;
@@ -71,7 +71,7 @@
7171

7272
$facades = [
7373
App::class => [ContainerInterface::class, [Container::class], '--desc', 'A facade for the global service container', '--api'],
74-
Cache::class => [CacheStoreInterface::class, [CacheStore::class], '--desc', 'A facade for the global cache store', '--api'],
74+
Cache::class => [CacheInterface::class, [CacheStore::class], '--desc', 'A facade for the global cache store', '--api'],
7575
Config::class => [ConfigurationManager::class, '--api'],
7676
Console::class => [ConsoleWriterInterface::class, [ConsoleWriter::class], '--desc', 'A facade for the global console writer', '--api'],
7777
Err::class => [ErrorHandler::class, '--skip', 'handleShutdown,handleError,handleException'],

src/Toolkit/Cache/CacheStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Salient\Cache;
44

5-
use Salient\Contract\Cache\CacheStoreInterface;
5+
use Salient\Contract\Cache\CacheInterface;
66
use Salient\Core\AbstractStore;
77
use DateInterval;
88
use DateTimeImmutable;
@@ -16,7 +16,7 @@
1616
*
1717
* @api
1818
*/
19-
final class CacheStore extends AbstractStore implements CacheStoreInterface
19+
final class CacheStore extends AbstractStore implements CacheInterface
2020
{
2121
private ?SQLite3Stmt $Stmt = null;
2222
private ?int $Now = null;
@@ -316,7 +316,7 @@ public function getItemKeys(): array
316316
/**
317317
* @inheritDoc
318318
*/
319-
public function asOfNow(?int $now = null): CacheStoreInterface
319+
public function asOfNow(?int $now = null): CacheInterface
320320
{
321321
if ($this->Now !== null) {
322322
throw new LogicException(

src/Toolkit/Container/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Salient\Cache\CacheStore;
66
use Salient\Console\Target\StreamTarget;
7-
use Salient\Contract\Cache\CacheStoreInterface;
7+
use Salient\Contract\Cache\CacheInterface;
88
use Salient\Contract\Console\ConsoleMessageType as MessageType;
99
use Salient\Contract\Container\ApplicationInterface;
1010
use Salient\Contract\Core\MessageLevel as Level;
@@ -500,7 +500,7 @@ final public function stopCache()
500500
return $this;
501501
}
502502

503-
private function checkCache(CacheStoreInterface $cache): bool
503+
private function checkCache(CacheInterface $cache): bool
504504
{
505505
return $cache instanceof CacheStore
506506
&& File::same($this->getCacheDb(false), $cache->getFilename());

src/Toolkit/Container/Container.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Salient\Container\Exception\ArgumentsNotUsedException;
1414
use Salient\Container\Exception\InvalidServiceException;
1515
use Salient\Container\Exception\ServiceNotFoundException;
16-
use Salient\Contract\Cache\CacheStoreInterface;
16+
use Salient\Contract\Cache\CacheInterface;
1717
use Salient\Contract\Console\ConsoleWriterInterface;
1818
use Salient\Contract\Container\ContainerAwareInterface;
1919
use Salient\Contract\Container\ContainerInterface;
@@ -58,7 +58,7 @@ class Container implements ContainerInterface, FacadeAwareInterface
5858
];
5959

6060
private const DEFAULT_SERVICES = [
61-
CacheStoreInterface::class => [CacheStore::class, ServiceLifetime::SINGLETON],
61+
CacheInterface::class => [CacheStore::class, ServiceLifetime::SINGLETON],
6262
ConsoleWriterInterface::class => [ConsoleWriter::class, ServiceLifetime::SINGLETON],
6363
LoggerInterface::class => [ConsoleLogger::class, ServiceLifetime::INHERIT],
6464
SyncStoreInterface::class => [SyncStore::class, ServiceLifetime::SINGLETON],

src/Toolkit/Contract/Cache/CacheStoreInterface.php renamed to src/Toolkit/Contract/Cache/CacheInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Salient\Contract\Cache;
44

5-
use Psr\SimpleCache\CacheInterface;
5+
use Psr\SimpleCache\CacheInterface as PsrCacheInterface;
66
use DateInterval;
77
use DateTimeInterface;
88
use LogicException;
99

1010
/**
1111
* @api
1212
*/
13-
interface CacheStoreInterface extends CacheInterface
13+
interface CacheInterface extends PsrCacheInterface
1414
{
1515
/**
1616
* Store an item under a given key
@@ -154,7 +154,7 @@ public function getItemKeys(): array;
154154
* @throws LogicException if the store is a copy, or if another copy of the
155155
* store is open.
156156
*/
157-
public function asOfNow(?int $now = null): CacheStoreInterface;
157+
public function asOfNow(?int $now = null): CacheInterface;
158158

159159
/**
160160
* Close the store and any underlying resources

src/Toolkit/Contract/Curler/CurlerInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Psr\Http\Message\RequestInterface;
77
use Psr\Http\Message\ResponseInterface;
88
use Psr\Http\Message\UriInterface as PsrUriInterface;
9-
use Salient\Contract\Cache\CacheStoreInterface;
9+
use Salient\Contract\Cache\CacheInterface;
1010
use Salient\Contract\Core\DateFormatterInterface;
1111
use Salient\Contract\Http\AccessTokenInterface;
1212
use Salient\Contract\Http\FormDataFlag;
@@ -475,7 +475,7 @@ public function withPager(?CurlerPagerInterface $pager, bool $alwaysPaginate = f
475475
/**
476476
* Get the endpoint's cache store
477477
*/
478-
public function getCacheStore(): ?CacheStoreInterface;
478+
public function getCacheStore(): ?CacheInterface;
479479

480480
/**
481481
* Get an instance with the given cache store
@@ -485,7 +485,7 @@ public function getCacheStore(): ?CacheStoreInterface;
485485
*
486486
* @return static
487487
*/
488-
public function withCacheStore(?CacheStoreInterface $store = null);
488+
public function withCacheStore(?CacheInterface $store = null);
489489

490490
/**
491491
* Check if the instance handles cookies

src/Toolkit/Core/Facade/Cache.php

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Toolkit/Curler/Curler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Psr\Http\Message\ResponseInterface;
88
use Psr\Http\Message\StreamInterface;
99
use Psr\Http\Message\UriInterface as PsrUriInterface;
10-
use Salient\Contract\Cache\CacheStoreInterface;
10+
use Salient\Contract\Cache\CacheInterface;
1111
use Salient\Contract\Core\Arrayable;
1212
use Salient\Contract\Core\Buildable;
1313
use Salient\Contract\Core\DateFormatterInterface;
@@ -115,7 +115,7 @@ class Curler implements CurlerInterface, Buildable
115115
protected array $Middleware = [];
116116
protected ?CurlerPagerInterface $Pager;
117117
protected bool $AlwaysPaginate;
118-
protected ?CacheStoreInterface $CacheStore;
118+
protected ?CacheInterface $CacheStore;
119119
protected ?string $CookiesCacheKey;
120120
protected bool $CacheResponses;
121121
protected bool $CachePostResponses;
@@ -164,7 +164,7 @@ class Curler implements CurlerInterface, Buildable
164164
* @param array<array{CurlerMiddlewareInterface|HttpRequestHandlerInterface|Closure(RequestInterface $request, Closure(RequestInterface): HttpResponseInterface $next, CurlerInterface $curler): ResponseInterface,1?:string|null}> $middleware Middleware applied to the request handler stack
165165
* @param CurlerPagerInterface|null $pager Pagination handler
166166
* @param bool $alwaysPaginate Use the pager to process requests even if no pagination is required
167-
* @param CacheStoreInterface|null $cacheStore Cache store used for cookie and response caching instead of the {@see Cache} facade's underlying store
167+
* @param CacheInterface|null $cacheStore Cache store used for cookie and response caching instead of the {@see Cache} facade's underlying store
168168
* @param bool $handleCookies Enable cookie handling
169169
* @param string|null $cookiesCacheKey Key to cache cookies under (cookie handling is implicitly enabled if given)
170170
* @param bool $cacheResponses Cache responses to GET and HEAD requests (HTTP caching headers are ignored; USE RESPONSIBLY)
@@ -195,7 +195,7 @@ public function __construct(
195195
array $middleware = [],
196196
?CurlerPagerInterface $pager = null,
197197
bool $alwaysPaginate = false,
198-
?CacheStoreInterface $cacheStore = null,
198+
?CacheInterface $cacheStore = null,
199199
bool $handleCookies = false,
200200
?string $cookiesCacheKey = null,
201201
bool $cacheResponses = false,
@@ -658,7 +658,7 @@ public function getPager(): ?CurlerPagerInterface
658658
/**
659659
* @inheritDoc
660660
*/
661-
public function getCacheStore(): ?CacheStoreInterface
661+
public function getCacheStore(): ?CacheInterface
662662
{
663663
return $this->CacheStore;
664664
}
@@ -946,7 +946,7 @@ public function withPager(
946946
/**
947947
* @inheritDoc
948948
*/
949-
public function withCacheStore(?CacheStoreInterface $store = null)
949+
public function withCacheStore(?CacheInterface $store = null)
950950
{
951951
return $this->with('CacheStore', $store);
952952
}
@@ -1600,7 +1600,7 @@ private function filterCookiesCacheKey(?string $cacheKey): string
16001600
return Arr::implode(':', [self::class, 'cookies', $cacheKey], '');
16011601
}
16021602

1603-
private function getCache(): CacheStoreInterface
1603+
private function getCache(): CacheInterface
16041604
{
16051605
return $this->CacheStore ?? Cache::getInstance();
16061606
}

src/Toolkit/Curler/CurlerBuilder.php

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)