# notificationx/3.2.10/includes/Core/Limiter.php

NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner &amp; Floating Notification Bar, version 3.2.10. 36 lines.

- Page: https://pluginprobe.com/plugins/notificationx/3.2.10/code/includes/Core/Limiter.php
- Raw: https://pluginprobe.com/plugins/notificationx/3.2.10/raw/includes/Core/Limiter.php
- Modified: 2023-02-12T06:13:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/notificationx/3.2.10/code/includes/Core/Limiter.php#L10-L20`.

```php
<?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);
        }
    }
}

```
