NodeStatisticsDatabaseStorage
class NodeStatisticsDatabaseStorage implements StatisticsStorageInterface (View source)
Provides the default database storage backend for statistics.
Properties
| protected Connection | $connection | The database connection used. |
|
| protected StateInterface | $state | The state service. |
|
| protected RequestStack | $requestStack | The request stack. |
Methods
Constructs the statistics storage.
Count a entity view.
Returns the number of times entities have been viewed.
Returns the number of times a single entity has been viewed.
Returns the number of times a entity has been viewed.
Delete counts for a specific entity.
Reset the day counter for all entities once every day.
Returns the highest 'totalcount' value.
Get current request time.
Details
__construct(Connection $connection, StateInterface $state, RequestStack $request_stack)
Constructs the statistics storage.
bool
recordView(int $id)
Count a entity view.
StatisticsViewsResult[]
fetchViews(array $ids)
Returns the number of times entities have been viewed.
StatisticsViewsResult|false
fetchView(int $id)
Returns the number of times a single entity has been viewed.
array
fetchAll(string $order = 'totalcount', int $limit = 5)
Returns the number of times a entity has been viewed.
bool
deleteViews(int $id)
Delete counts for a specific entity.
resetDayCount()
Reset the day counter for all entities once every day.
int
maxTotalCount()
Returns the highest 'totalcount' value.
protected int
getRequestTime()
Get current request time.