vendor/codeages/biz-framework/src/Dao/CacheStrategy/TableStrategy.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\Biz\Framework\Dao\CacheStrategy;
use Codeages\Biz\Framework\Dao\CacheStrategy;
use Codeages\Biz\Framework\Dao\GeneralDaoInterface;
/**
* 表级别缓存策略.
*/
class TableStrategy implements CacheStrategy
{
private $redis;
private $storage;
const LIFE_TIME = 3600;
const MAX_WAVE_CACHEABLE_TIMES = 32;
public function __construct($redis, $storage)
{
$this->redis = $redis;
$this->storage = $storage;
}
public function beforeQuery(GeneralDaoInterface $dao, $method, $arguments)
{
$key = $this->key($dao, $method, $arguments);
return $this->redis->get($key);
}
public function afterQuery(GeneralDaoInterface $dao, $method, $arguments, $data)
{
$key = $this->key($dao, $method, $arguments);
return $this->redis->set($key, $data, self::LIFE_TIME);
}
public function afterCreate(GeneralDaoInterface $dao, $method, $arguments, $row)
{
$this->upTableVersion($dao);
}
public function afterUpdate(GeneralDaoInterface $dao, $method, $arguments, $row)
{
$this->upTableVersion($dao);
}
public function flush(GeneralDaoInterface $dao)
{
$this->upTableVersion($dao);
}
public function afterWave(GeneralDaoInterface $dao, $method, $arguments, $affected)
{
$declares = $dao->declares();
if ('wave' === $method && !empty($declares['wave_cahceable_fields'])) {
$cacheable = true;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。