1 | <?php |
||
19 | class cache |
||
20 | { |
||
21 | /** |
||
22 | * This method creates a new cache store ( \arc\cache\Store ) |
||
23 | * It will store the cache on disk in a folder defined by ARC_CACHE_DIR, or if not |
||
24 | * defined in the system temp dir under arc/cache/. |
||
25 | * @param string $prefix Optional. A prefix name or path for subsequent cache images |
||
26 | * @param mixed $timeout Optional. Number of seconds (int) or string parseable by strtotime. Defaults to 7200. |
||
27 | * @return cache\Store |
||
28 | * @throws ExceptionConfigError |
||
29 | */ |
||
30 | 4 | public static function create($prefix = null, $timeout = 7200) |
|
55 | |||
56 | /** |
||
57 | * This method creates a new cache store, if one is not available in \arc\context yet, stores it in \arc\context |
||
58 | * and returns it. |
||
59 | * @return cache\Store |
||
60 | */ |
||
61 | 2 | public static function getCacheStore() |
|
70 | |||
71 | /** |
||
72 | * This reroutes any static calls to \arc\cache to the cache store instance in \arc\context |
||
73 | * @param $name |
||
74 | * @param $args |
||
75 | * @return mixed |
||
76 | * @throws ExceptionMethodNotFound |
||
77 | */ |
||
78 | 2 | public static function __callStatic($name, $args) |
|
87 | |||
88 | /** |
||
89 | * Creates a new caching proxy object for any given object. |
||
90 | * @param $object The object to cache |
||
91 | * @param mixed $cacheControl Either an integer with the number of seconds to cache stuff, or a closure that returns an int. |
||
92 | * The closure is called with one argument, an array with the following information: |
||
93 | * - target The cached object a method was called on. |
||
94 | * - method The method called |
||
95 | * - arguments The arguments to the method |
||
96 | * - output Any output generated by the method |
||
97 | * - result The result of the method |
||
98 | * @return cache\Proxy |
||
99 | */ |
||
100 | 2 | public static function proxy($object, $cacheControl = 7200) |
|
104 | } |
||
105 |