File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
src/phpFastCache/Drivers/Zendshm Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -130,11 +130,20 @@ protected function driverConnect()
130130 */
131131 public function getStats ()
132132 {
133- $ stats = (array ) zend_shm_cache_info ();
134- return (new driverStatistic ())
135- ->setData (implode (', ' , array_keys ($ this ->namespaces )))
136- ->setInfo (sprintf ("The Zend memory have %d item(s) in cache. \n For more information see RawData. " ,$ stats [ 'items_total ' ]))
137- ->setRawData ($ stats )
138- ->setSize ($ stats [ 'memory_total ' ]);
133+ if (function_exists ('zend_shm_cache_info ' )) {
134+ $ stats = (array )zend_shm_cache_info ();
135+ return (new driverStatistic ())
136+ ->setData (implode (', ' , array_keys ($ this ->namespaces )))
137+ ->setInfo (sprintf ("The Zend memory have %d item(s) in cache. \n For more information see RawData. " , $ stats ['items_total ' ]))
138+ ->setRawData ($ stats )
139+ ->setSize ($ stats ['memory_total ' ]);
140+ } else {
141+ /** zend_shm_cache_info supported V8 or higher */
142+ return (new driverStatistic ())
143+ ->setData (implode (', ' , array_keys ($ this ->namespaces )))
144+ ->setInfo ("The Zend memory statistics is only supported by ZendServer V8 or higher " )
145+ ->setRawData (null )
146+ ->setSize (0 );
147+ }
139148 }
140149}
You can’t perform that action at this time.
0 commit comments