Skip to content

Commit 93fc95a

Browse files
cookieguruNyholm
authored andcommitted
Make ProviderCache not final (#837)
1 parent 8f09115 commit 93fc95a

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/Provider/Cache/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44

5+
## 4.1.0 (2018-03-16)
6+
7+
* Changed: `ProviderCache` is no longer final allowing `ProviderCache::getCacheKey` to be overridden
8+
59
## 4.0.1
610

711
### Changed

src/Provider/Cache/ProviderCache.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ final class ProviderCache implements Provider
2626
/**
2727
* @var Provider
2828
*/
29-
private $realProvider;
29+
protected $realProvider;
3030

3131
/**
3232
* @var CacheInterface
3333
*/
34-
private $cache;
34+
protected $cache;
3535

3636
/**
3737
* How log a result is going to be cached.
3838
*
3939
* @var int|null
4040
*/
41-
private $lifetime;
41+
protected $lifetime;
4242

4343
/**
4444
* @param Provider $realProvider
4545
* @param CacheInterface $cache
4646
* @param int $lifetime
4747
*/
48-
public function __construct(Provider $realProvider, CacheInterface $cache, int $lifetime = null)
48+
final public function __construct(Provider $realProvider, CacheInterface $cache, int $lifetime = null)
4949
{
5050
$this->realProvider = $realProvider;
5151
$this->cache = $cache;
@@ -55,7 +55,7 @@ public function __construct(Provider $realProvider, CacheInterface $cache, int $
5555
/**
5656
* {@inheritdoc}
5757
*/
58-
public function geocodeQuery(GeocodeQuery $query): Collection
58+
final public function geocodeQuery(GeocodeQuery $query): Collection
5959
{
6060
$cacheKey = $this->getCacheKey($query);
6161
if (null !== $result = $this->cache->get($cacheKey)) {
@@ -71,7 +71,7 @@ public function geocodeQuery(GeocodeQuery $query): Collection
7171
/**
7272
* {@inheritdoc}
7373
*/
74-
public function reverseQuery(ReverseQuery $query): Collection
74+
final public function reverseQuery(ReverseQuery $query): Collection
7575
{
7676
$cacheKey = $this->getCacheKey($query);
7777
if (null !== $result = $this->cache->get($cacheKey)) {
@@ -92,7 +92,7 @@ public function getName(): string
9292
return sprintf('%s (cache)', $this->realProvider->getName());
9393
}
9494

95-
public function __call($method, $args)
95+
final public function __call($method, $args)
9696
{
9797
return call_user_func_array([$this->realProvider, $method], $args);
9898
}
@@ -102,7 +102,7 @@ public function __call($method, $args)
102102
*
103103
* @return string
104104
*/
105-
private function getCacheKey($query): string
105+
protected function getCacheKey($query): string
106106
{
107107
// Include the major version number of the geocoder to avoid issues unserializing.
108108
return 'v4'.sha1((string) $query);

0 commit comments

Comments
 (0)