Skip to content

Commit 71dd8c3

Browse files
authored
Merge pull request #319 from Geolim4/final
Implemented JsonSerializable interface to ExtendedCacheItemInterface
2 parents b550d73 + 2e64b17 commit 71dd8c3

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/phpFastCache/Api.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class Api
2222
{
23-
protected static $version = '1.1.0';
23+
protected static $version = '1.1.1';
2424

2525
/**
2626
* This method will returns the current
@@ -45,6 +45,9 @@ public static function getVersion()
4545
public static function getChangelog()
4646
{
4747
return <<<CHANGELOG
48+
- 1.1.1
49+
-- Implemented JsonSerializable interface to ExtendedCacheItemInterface
50+
4851
- 1.1.0
4952
-- Implemented JSON methods such as:
5053
ExtendedCacheItemPoolInterface::getItemsAsJsonString()

src/phpFastCache/Cache/ExtendedCacheItemInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Interface ExtendedCacheItemInterface
2121
* @package phpFastCache\Cache
2222
*/
23-
interface ExtendedCacheItemInterface extends CacheItemInterface
23+
interface ExtendedCacheItemInterface extends CacheItemInterface, \JsonSerializable
2424
{
2525
/**
2626
* @return mixed

src/phpFastCache/Cache/ItemBaseTrait.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,13 @@ public function getDataAsJsonString($option = 0, $depth = 512)
418418
}
419419

420420
/**
421-
* @throws \RuntimeException
422-
*/
423-
/* final public function __sleep()
424-
{
425-
$info = get_object_vars($this);
426-
$info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')';
427-
428-
return (array) $info;
429-
}*/
421+
* Implements \JsonSerializable interface
422+
* @return mixed
423+
*/
424+
public function jsonSerialize()
425+
{
426+
return $this->get();
427+
}
430428

431429
/**
432430
* Prevent recursions for Debug (php 5.6+)

0 commit comments

Comments
 (0)