mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
25 lines
741 B
PHP
25 lines
741 B
PHP
<?php
|
|
|
|
namespace Gazelle\Stats;
|
|
|
|
class Collage extends \Gazelle\Base {
|
|
protected const CACHE_KEY = 'stats_collages';
|
|
|
|
public function collageTotal(): int {
|
|
$count = self::$cache->get_value(self::CACHE_KEY);
|
|
if ($count === false) {
|
|
$count = (int)self::$db->scalar("
|
|
SELECT count(*) FROM collages WHERE Deleted = '0'
|
|
");
|
|
self::$cache->cache_value(self::CACHE_KEY, $count, 43200 + random_int(0, 300));
|
|
}
|
|
return $count;
|
|
}
|
|
|
|
public function increment(): int {
|
|
$count = (int)self::$cache->get_value(self::CACHE_KEY) + 1;
|
|
self::$cache->cache_value(self::CACHE_KEY, $count, 43200 + random_int(0, 300));
|
|
return $count;
|
|
}
|
|
}
|