Преглед изворни кода

ZF-10500: DOC: the method 'load' can return empty values on hit

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23013 44c647ce-9c0f-0410-b52a-842ac1e357ba
mabe пре 15 година
родитељ
комит
283a7a307f

+ 4 - 4
documentation/manual/en/module_specs/Zend_Cache-Frontends.xml

@@ -164,7 +164,7 @@
 
 
 $id = 'myBigLoop'; // cache id of "what we want to cache"
 $id = 'myBigLoop'; // cache id of "what we want to cache"
 
 
-if (!($data = $cache->load($id))) {
+if ( ($data = $cache->load($id)) === false ) {
     // cache miss
     // cache miss
 
 
     $data = '';
     $data = '';
@@ -189,7 +189,7 @@ $id1 = 'foo';
 $id2 = 'bar';
 $id2 = 'bar';
 
 
 // block 1
 // block 1
-if (!($data = $cache->load($id1))) {
+if ( ($data = $cache->load($id1)) === false ) {
     // cache missed
     // cache missed
 
 
     $data = '';
     $data = '';
@@ -206,7 +206,7 @@ echo($data);
 echo('NEVER CACHED! ');
 echo('NEVER CACHED! ');
 
 
 // block 2
 // block 2
-if (!($data = $cache->load($id2))) {
+if ( ($data = $cache->load($id2)) === false ) {
     // cache missed
     // cache missed
 
 
     $data = '';
     $data = '';
@@ -229,7 +229,7 @@ echo($data);
             <programlisting language="php"><![CDATA[
             <programlisting language="php"><![CDATA[
 // the compact construction
 // the compact construction
 // (not good if you cache empty strings and/or booleans)
 // (not good if you cache empty strings and/or booleans)
-if (!($data = $cache->load($id))) {
+if ( ($data = $cache->load($id)) === false ) {
 
 
     // cache missed
     // cache missed
 
 

+ 1 - 1
documentation/manual/en/module_specs/Zend_Cache-Introduction.xml

@@ -74,7 +74,7 @@ $cache = Zend_Cache::factory('Core',
 // $cache initialized in previous example
 // $cache initialized in previous example
 
 
 // see if a cache already exists:
 // see if a cache already exists:
-if(!$result = $cache->load('myresult')) {
+if( ($result = $cache->load('myresult')) === false ) {
 
 
     // cache miss; connect to the database
     // cache miss; connect to the database