Skip to content

[V5˖] The cache statistics

Georges.L edited this page Jan 13, 2024 · 4 revisions

The V5 introduce a new driverStatistic object. You can extend a specific driver like this:

 $driverInstance = CacheManager::getInstance('driverName');
 $stats = $driverInstance->stats();// Returns a \Phpfastcache\Entities\DriverStatistic object

\Phpfastcache\Entities\DriverStatistic API:

Method Description
getInfo():string Return quick information about the driver instance
getSize():int|null Return the approximate size taken by the driver instance (in bytes) (null if unsupported by the driver)
getCount():int Return the approximate count of elements stored in a driver database (or collection if applicable). Added in v9.2.3
getData:array Return an array of item keys used by this driver instance (deprecated as of v9.2.3, will be removed as of v10)
getRawData:mixed Return a bunch of random data provided by the driver. Any type can be provided, usually an array