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
4 changes: 4 additions & 0 deletions src/Provider/Cache/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

## 4.1.0 (2018-03-16)

* Changed: `ProviderCache` is no longer final allowing `ProviderCache::getCacheKey` to be overridden

## 4.0.1

### Changed
Expand Down
16 changes: 8 additions & 8 deletions src/Provider/Cache/ProviderCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ final class ProviderCache implements Provider
/**
* @var Provider
*/
private $realProvider;
protected $realProvider;

/**
* @var CacheInterface
*/
private $cache;
protected $cache;

/**
* How log a result is going to be cached.
*
* @var int|null
*/
private $lifetime;
protected $lifetime;

/**
* @param Provider $realProvider
* @param CacheInterface $cache
* @param int $lifetime
*/
public function __construct(Provider $realProvider, CacheInterface $cache, int $lifetime = null)
final public function __construct(Provider $realProvider, CacheInterface $cache, int $lifetime = null)
{
$this->realProvider = $realProvider;
$this->cache = $cache;
Expand All @@ -55,7 +55,7 @@ public function __construct(Provider $realProvider, CacheInterface $cache, int $
/**
* {@inheritdoc}
*/
public function geocodeQuery(GeocodeQuery $query): Collection
final public function geocodeQuery(GeocodeQuery $query): Collection
{
$cacheKey = $this->getCacheKey($query);
if (null !== $result = $this->cache->get($cacheKey)) {
Expand All @@ -71,7 +71,7 @@ public function geocodeQuery(GeocodeQuery $query): Collection
/**
* {@inheritdoc}
*/
public function reverseQuery(ReverseQuery $query): Collection
final public function reverseQuery(ReverseQuery $query): Collection
{
$cacheKey = $this->getCacheKey($query);
if (null !== $result = $this->cache->get($cacheKey)) {
Expand All @@ -92,7 +92,7 @@ public function getName(): string
return sprintf('%s (cache)', $this->realProvider->getName());
}

public function __call($method, $args)
final public function __call($method, $args)
{
return call_user_func_array([$this->realProvider, $method], $args);
}
Expand All @@ -102,7 +102,7 @@ public function __call($method, $args)
*
* @return string
*/
private function getCacheKey($query): string
protected function getCacheKey($query): string
{
// Include the major version number of the geocoder to avoid issues unserializing.
return 'v4'.sha1((string) $query);
Expand Down