bookinventory/app/Services/BookInformation/CachedService.php

19 lines
405 B
PHP
Raw Normal View History

2020-12-27 00:34:07 +00:00
<?php
namespace App\Services\BookInformation;
use Cache;
class CachedService implements BookLookupService {
private $service;
public function __construct($service) {
$this->service = $service;
}
public function lookup($isbn) {
return Cache::remember('isbn_' . $isbn, 86400, function() use ($isbn) {
return $this->service->lookup($isbn);
});
}
}