HEX
Server: LiteSpeed
System: Linux pbn-10.isgood.host 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User: pg88zccom (1239)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /usr/local/lsws/pg88zc.com/html/wp-content/plugins/mlink-plugin/includes/helpers/cache.php
<?php

namespace GwdMlinkPlugin\Helpers;

class Cache
{

    public function get($key)
    {
        $filePath = $this->getKeyPath($key);
        if (file_exists($filePath)) {
            return file_get_contents($filePath);
        }

        return false;
    }

    public function set($key, $data)
    {
        $filePath = $this->getKeyPath($key);

        if (!file_exists(dirname($filePath))) {
            mkdir(dirname($filePath), 0755, true);
        }

        return file_put_contents($filePath, json_encode($data));
    }

    private function getKeyPath($key)
    {
        $cachePath = GWD_MLINK_DIR . '/includes/cache/';
        return $cachePath . $key . '.json';
    }

    public function delete($key)
    {
        $filePath = $this->getKeyPath($key);

        return unlink($filePath);
    }
}