PHP code example of gemini / cache

1. Go to this page and download the library: Download gemini/cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gemini / cache example snippets




return [
    Hyperf\Cache\Aspect\CacheableAspect::class => Gemini\Cache\Aspect\CacheableAspect::class,
];



use Hyperf\Cache\Annotation\Cacheable;

class UserService
{
    public $id = 1;

    /**
     * @Cacheable(prefix="test", value="#{this.id}")
     */
    function getCache()
    {
        return uniqid();
    }
}

$res = (new UserService())->getCache(); // 生成的缓存 KEY 为 test:1




return [
    Hyperf\Cache\AnnotationManager::class => Gemini\Cache\AnnotationManager::class
];