Skip to content

关于性能优化的一点建议 #5

@bin20060407

Description

@bin20060407

通过数组setTree或者文件的方式都不是很高效,建议支持可以Cache HashMap对象
SensitiveHelper.php 修改

    public function getTree() {
        return $this->wordTree;
    }

    public function setTreeByCache(HashMap $tree)
    {
        $this->wordTree = $tree;
        return $this;
    }

调用

$handle = SensitiveHelper::init();
// 写缓存
file_put_contents('tree.cache', serialize($handle->getTree()));
// 使用缓存
$handle->setTreeByCache(unserialize(file_get_contents('tree.cache')));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions