diff --git a/src/ClassBoundCacheContract.php b/src/ClassBoundCacheContract.php index 04c4510..a926066 100644 --- a/src/ClassBoundCacheContract.php +++ b/src/ClassBoundCacheContract.php @@ -21,7 +21,7 @@ public function __construct(ClassBoundCacheInterface $classBoundCache) * * @return mixed */ - public function get(ReflectionClass $reflectionClass, callable $resolver, string $key = '') + public function get(ReflectionClass $reflectionClass, callable $resolver, string $key = '', ?int $ttl = null) { $cacheKey = $reflectionClass->getName() . '__' . $key; $item = $this->classBoundCache->get($cacheKey); @@ -31,7 +31,7 @@ public function get(ReflectionClass $reflectionClass, callable $resolver, string $item = $resolver(); - $this->classBoundCache->set($cacheKey, $item, $reflectionClass); + $this->classBoundCache->set($cacheKey, $item, $reflectionClass, $ttl); return $item; } diff --git a/src/ClassBoundCacheContractInterface.php b/src/ClassBoundCacheContractInterface.php index 2f4a177..45b5c8a 100644 --- a/src/ClassBoundCacheContractInterface.php +++ b/src/ClassBoundCacheContractInterface.php @@ -13,5 +13,5 @@ interface ClassBoundCacheContractInterface * * @return mixed */ - public function get(ReflectionClass $reflectionClass, callable $resolver, string $key = ''); + public function get(ReflectionClass $reflectionClass, callable $resolver, string $key = '', ?int $ttl = null); }