Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor fixes to the stats example

  • Loading branch information...
commit 3ed95219f40680facb8e4c9e12c0c359f4c23c75 1 parent de3381a
@lsmith77 lsmith77 authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 en/reference/caching.rst
View
9 en/reference/caching.rst
@@ -42,7 +42,10 @@ of the request can be found below.
$cache->contains("some key");
$cache->delete("some key");
- // note all cache backends provide stats
- foreach ($cache->getStats() as $key => $value) {
- echo "$key: $value";
+ // not all cache backends provide stats, f.e. ArrayCache does not
+ $stats = $cache->getStats();
+ if (!empty($stats)) {
+ foreach ($stats as $key => $value) {
+ echo "$key: $value";
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.