|
Server : LiteSpeed System : Linux server104.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64 User : saleoqej ( 6848) PHP Version : 8.0.30 Disable Function : NONE Directory : /home/saleoqej/chijamzacademy.com/wp-content/plugins/notificationx/includes/Core/ |
<?php
namespace NotificationX\Core;
use NotificationX\Admin\Entries;
use NotificationX\Admin\Settings;
use NotificationX\Core\Database;
use NotificationX\GetInstance;
/**
* @method static Limiter get_instance($args = null)
*/
class Limiter {
use GetInstance;
/**
* Initial Invoked
*/
public function __construct() {
}
public function remove($nx_id, $new) {
$count = Entries::get_instance()->count($nx_id, 'nx_id');
$limit = Settings::get_instance()->get('settings.cache_limit', 100);
if ($limit <= 0) {
$limit = 100;
}
if ($new + $count > $limit) {
$overflow = ($new + $count) - $limit;
Entries::get_instance()->delete_entries($nx_id, $overflow);
}
}
}