eecjimmy/basic

There is no license information available for the latest version (1.0) of this package.

basic development packages

1.0 2021-07-30 12:43 UTC

This package is auto-updated.

Last update: 2025-07-09 21:34:28 UTC


README

  • composer require eecjimmy/basic
namespace demo;
use eecjimmy\Basic\CacheableTrait;
class Demo
{

    use CacheableTrait;

    public function getUser()
    {
        return $this->cacheGet(__METHOD__, function () {
            echo "cache missing...\n";
            return 'user';
        });
    }

    public static function getStudent()
    {
        return self::cacheGetStatic(__METHOD__, function () {
            echo "cache missing...\n";
            return 'student';
        });
    }

    public function getWithArgument($a)
    {
        $key = md5(__METHOD__ . json_encode(func_get_args()));
        return $this->cacheGet($key, function () {
            echo "cache missing...\n";
            return 'with-argument';
        });
    }
}