Failed Conditions
Branch v3.x (aec8e0)
by Chad
01:59
created

CacheInterface::get()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
1
<?php
2
3
namespace Chadicus\Marvel\Api\Cache;
4
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
8
/**
9
 * Interface for caching API responses
10
 */
11
interface CacheInterface
12
{
13
    /**
14
     * The maximum ttl for cached responses (24 hours).
15
     *
16
     * @const integer
17
     */
18
    const MAX_TTL = 86400;
19
20
    /**
21
     * Store the api $response as the cached result of the api $request.
22
     *
23
     * @param RequestInterface  $request    The request for which the response will be cached.
24
     * @param ResponseInterface $response   The reponse to cache.
25
     * @param integer           $timeToLive The time in seconds that the cache should live.
26
     *
27
     * @return void
28
     */
29
    public function set(RequestInterface $request, ResponseInterface $response, int $timeToLive = null);
0 ignored issues
show
Coding Style introduced by
Unknown type hint "int" found for $timeToLive
Loading history...
30
31
    /**
32
     * Retrieve the cached results of the api $request.
33
     *
34
     * @param RequestInterface $request A request for which the response may be cached.
35
     *
36
     * @return ResponseInterface|null
37
     */
38
    public function get(RequestInterface $request);
39
}
40