1: <?php
2:
3: namespace Guzzle\Cache;
4:
5: /**
6: * Interface for cache adapters.
7: *
8: * Cache adapters allow Guzzle to utilize various frameworks for caching HTTP responses.
9: *
10: * @link http://www.doctrine-project.org/ Inspired by Doctrine 2
11: */
12: interface CacheAdapterInterface
13: {
14: /**
15: * Test if an entry exists in the cache.
16: *
17: * @param string $id cache id The cache id of the entry to check for.
18: * @param array $options Array of cache adapter options
19: *
20: * @return bool Returns TRUE if a cache entry exists for the given cache id, FALSE otherwise.
21: */
22: public function contains($id, array $options = null);
23:
24: /**
25: * Deletes a cache entry.
26: *
27: * @param string $id cache id
28: * @param array $options Array of cache adapter options
29: *
30: * @return bool TRUE on success, FALSE on failure
31: */
32: public function delete($id, array $options = null);
33:
34: /**
35: * Fetches an entry from the cache.
36: *
37: * @param string $id cache id The id of the cache entry to fetch.
38: * @param array $options Array of cache adapter options
39: *
40: * @return string The cached data or FALSE, if no cache entry exists for the given id.
41: */
42: public function fetch($id, array $options = null);
43:
44: /**
45: * Puts data into the cache.
46: *
47: * @param string $id The cache id
48: * @param string $data The cache entry/data
49: * @param int|bool $lifeTime The lifetime. If != false, sets a specific lifetime for this cache entry
50: * @param array $options Array of cache adapter options
51: *
52: * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
53: */
54: public function save($id, $data, $lifeTime = false, array $options = null);
55: }
56: