PHP code example of cryjkd / model-cache

1. Go to this page and download the library: Download cryjkd/model-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/ */

    

cryjkd / model-cache example snippets


php bin/hyperf.php vendor:publish cryjkd/model-cache

return [
    'redis_select' => 'default',		//redis的名称
    'null_ttl' => 3600				    //数据库数据为空时,redis的过期时间
];

  \Hyperf\Utils\ApplicationContext::getContainer()->get(UserModel::class)->setData($userId, ['level' => 10]);