Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
eZ\Publish\Core\Persistence\Cache\PersistenceLogger Class Reference

Log un-cached & cached use of SPI Persistence. More...

## Public Member Functions
| __construct (bool $logCalls=true)
| logCall (string $method, array $arguments=[])
| Log uncached SPI calls with method name and arguments. More...
| logCacheMiss (array $arguments=[], int $traceOffset=2)
| Log Cache miss, gets info it needs by backtrace if needed. More...
| logCacheHit (array $arguments=[], int $traceOffset=2, bool $inMemory=false)
| Log a Cache hit, gets info it needs by backtrace if needed. More...
| logUnCachedHandler (string $handler)
| Log un-cached handler being loaded. More...
| getName ()
| getCount ()
| Counts the total of spi uncached call (cache miss and uncached calls). More...
| getStats ()
| Get stats (call/miss/hit/memory). More...
| isCallsLoggingEnabled ()
| getCalls ()
| getLoadedUnCachedHandlers ()

## Public Attributes
const | NAME = 'PersistenceLogger'

## Protected Attributes
| $stats
| $logCalls = true
| $calls = []
| $unCachedHandlers = []

## Private Member Functions
| collectCacheCallData ($method, array $arguments, array $trimmedBacktrace, string $type)
| Collection method for {. More...
| getSimpleCallTrace (array $backtrace)
| Simplify trace to an array of strings. More...

## Detailed Description

Log un-cached & cached use of SPI Persistence.

Definition at line 14 of file PersistenceLogger.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::__construct | ( | bool | $logCalls = `true` | ) |

Parameters

  bool | $logCalls | Flag to enable logging of calls or not, provides extra debug info about calls made to SPI level, including where they come form. However this uses quite a bit of memory.

Definition at line 39 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\$logCalls.

## Member Function Documentation

## ◆ collectCacheCallData()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::collectCacheCallData | ( |  | $method,
|  | array | $arguments,
|  | array | $trimmedBacktrace,
|  | string | $type
| ) |  |
| private

Collection method for {.

See also
  logCacheHit()}, {
  logCacheMiss()} & {
  logCall()}.

Parameters

  | $method |
  array | $arguments |
  array | $trimmedBacktrace |
  string | $type |

Definition at line 134 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\getSimpleCallTrace().

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\logCacheHit(), eZ\Publish\Core\Persistence\Cache\PersistenceLogger\logCacheMiss(), and eZ\Publish\Core\Persistence\Cache\PersistenceLogger\logCall().

## ◆ getCalls()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::getCalls | ( |  | ) |

Definition at line 243 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\$calls.

## ◆ getCount()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::getCount | ( |  | ) |

Counts the total of spi uncached call (cache miss and uncached calls).

Deprecated:
  Since 7.5, use getStats().

Definition at line 223 of file PersistenceLogger.php.

## ◆ getLoadedUnCachedHandlers()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::getLoadedUnCachedHandlers | ( |  | ) |

Definition at line 248 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\$unCachedHandlers.

## ◆ getName()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::getName | ( |  | ) |

Definition at line 213 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\NAME.

## ◆ getSimpleCallTrace()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::getSimpleCallTrace | ( | array | $backtrace | ) |
| private

Simplify trace to an array of strings.

Skipps any traces from Syfony proxies or closures to make trace as readable as possible in as few lines as possible. And point is to identify which code outside kernel is triggering the SPI call, so trace stops one call after namespace is no longer in eZ\Publish\Core.

Parameters

  array | $backtrace | Partial backtrace from |debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) or similar.

Returns
  string[]

Definition at line 175 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\$calls.

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\collectCacheCallData().

## ◆ getStats()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::getStats | ( |  | ) |

Get stats (call/miss/hit/memory).

Since
  7.5

Definition at line 233 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\$stats.

## ◆ isCallsLoggingEnabled()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::isCallsLoggingEnabled | ( |  | ) |

Definition at line 238 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\$logCalls.

## ◆ logCacheHit()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::logCacheHit | ( | array | $arguments = `[]`,
|  | int | $traceOffset = `2`,
|  | bool | $inMemory = `false`
| ) |  |

Log a Cache hit, gets info it needs by backtrace if needed.

Since
  7.5

Parameters

  array | $arguments |
  int | $traceOffset |
  bool | $inMemory | Denotes is cache hit was from memory (php variable), as opposed to from cache pool which is usually disk or remote cache service.

Definition at line 105 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\collectCacheCallData().

## ◆ logCacheMiss()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::logCacheMiss | ( | array | $arguments = `[]`,
|  | int | $traceOffset = `2`
| ) |  |

Log Cache miss, gets info it needs by backtrace if needed.

Since
  7.5

Parameters

  array | $arguments |
  int | $traceOffset |

Definition at line 79 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\collectCacheCallData().

## ◆ logCall()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::logCall | ( | string | $method,
|  | array | $arguments = `[]`
| ) |  |

Log uncached SPI calls with method name and arguments.

NOTE: As of 7.5 this method is meant for logging calls to uncached spi method calls, for cache miss calls to cached SPI methods migrate to use {

See also
  logCacheMiss()}.

Parameters

  string | $method |
  array | $arguments |

Definition at line 53 of file PersistenceLogger.php.

References eZ\Publish\Core\Persistence\Cache\PersistenceLogger\collectCacheCallData().

## ◆ logUnCachedHandler()

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::logUnCachedHandler | ( | string | $handler | ) |

Log un-cached handler being loaded.

Parameters

  string | $handler |

Definition at line 205 of file PersistenceLogger.php.

## Member Data Documentation

## ◆ $calls

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::$calls = []
| protected

Definition at line 30 of file PersistenceLogger.php.

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\getCalls(), and eZ\Publish\Core\Persistence\Cache\PersistenceLogger\getSimpleCallTrace().

## ◆ $logCalls

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::$logCalls = true
| protected

Definition at line 27 of file PersistenceLogger.php.

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\__construct(), and eZ\Publish\Core\Persistence\Cache\PersistenceLogger\isCallsLoggingEnabled().

## ◆ $stats

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::$stats
| protected

Initial value:
= [
'uncached' => 0,
'miss' => 0,
'hit' => 0,
'memory' => 0,
]

Definition at line 19 of file PersistenceLogger.php.

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\getStats().

## ◆ $unCachedHandlers

eZ\Publish\Core\Persistence\Cache\PersistenceLogger::$unCachedHandlers = []
| protected

Definition at line 33 of file PersistenceLogger.php.

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\getLoadedUnCachedHandlers().

## ◆ NAME

const eZ\Publish\Core\Persistence\Cache\PersistenceLogger::NAME = 'PersistenceLogger'

Definition at line 16 of file PersistenceLogger.php.

Referenced by eZ\Publish\Core\Persistence\Cache\PersistenceLogger\getName().

The documentation for this class was generated from the following file:

- PersistenceLogger.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.