HEX
Server: LiteSpeed
System: Linux pbn-18.isgood.host 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User: king88zccom (1235)
PHP: 8.1.32
Disabled: NONE
Upload Files
File: /usr/local/lsws/king88zc.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);
    }
}