PHP序列化SplPriorityQueue

时间:2016-11-11 13:03:57

标签: php spl

今天我遇到了SplPriorityQueue的问题..我想缓存队列,但我的缓存一直都是空的。经过一个多小时的时间在我的代码中找到问题...我在序列化SplPriorityQueue时看到我得到一个空字符串。

有人可以在这里解释为什么会发生这种情况我认为Queue是一个简单的对象吗?

  $institutionList = new SplPriorityQueue();

    foreach ($institutions as $institution) {

        $institution->currentPriority = 0;

        $institution->currentPriority += 2 * $this->diffSearchString($searchStrings, $institution->title);

        $institution->currentPriority += $this->diffSearchString($searchStrings, $institution->shortDescription);

        $institution->currentPriority += $this->diffSearchString($searchStrings, $institution->measures);

        $institution->currentPriority += $this->diffSearchString($searchStrings, $institution->personGroups);

        $institution->currentPriority += $this->diffSearchString($searchStrings, $institution->regions);

        $institution->currentPriority += $this->diffSearchString($searchStrings, $institution->tags);

        if ($institution->currentPriority > 0) {
            $institutionList->insert($institution->id, $institution->currentPriority);
        }
    }
     $test =  serialize($institutionList);

0 个答案:

没有答案