| @@ 128-137 (lines=10) @@ | ||
| 125 | * @param \Closure $callback |
|
| 126 | * @return mixed |
|
| 127 | */ |
|
| 128 | public function remember($key, $minutes, Closure $callback) |
|
| 129 | { |
|
| 130 | if (!is_null($value = $this->get($key))) { |
|
| 131 | return $value; |
|
| 132 | } |
|
| 133 | ||
| 134 | $this->put($key, $value = $callback(), $minutes); |
|
| 135 | ||
| 136 | return $value; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Get an item from the cache, or store the default value forever. |
|
| @@ 146-155 (lines=10) @@ | ||
| 143 | * @param \Closure $callback |
|
| 144 | * @return mixed |
|
| 145 | */ |
|
| 146 | public function rememberForever($key, Closure $callback) |
|
| 147 | { |
|
| 148 | if (!is_null($value = $this->get($key))) { |
|
| 149 | return $value; |
|
| 150 | } |
|
| 151 | ||
| 152 | $this->forever($key, $value = $callback()); |
|
| 153 | ||
| 154 | return $value; |
|
| 155 | } |
|
| 156 | ||
| 157 | /** |
|
| 158 | * Remove an item from the cache. |
|