Store serialized representations of queue items in the queue
This commit is contained in:
parent
611924e814
commit
b34bbb0e80
@ -139,20 +139,13 @@ abstract class QueueManager extends IoManager
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode an object for queued storage.
|
* Encode an object for queued storage.
|
||||||
* Next gen may use serialization.
|
|
||||||
*
|
*
|
||||||
* @param mixed $object
|
* @param mixed $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function encode($object)
|
protected function encode($object)
|
||||||
{
|
{
|
||||||
if ($object instanceof Notice) {
|
return serialize($object);
|
||||||
return $object->id;
|
|
||||||
} else if (is_string($object)) {
|
|
||||||
return $object;
|
|
||||||
} else {
|
|
||||||
throw new ServerException("Can't queue this type", 500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,11 +157,7 @@ abstract class QueueManager extends IoManager
|
|||||||
*/
|
*/
|
||||||
protected function decode($frame)
|
protected function decode($frame)
|
||||||
{
|
{
|
||||||
if (is_numeric($frame)) {
|
return unserialize($frame);
|
||||||
return Notice::staticGet(intval($frame));
|
|
||||||
} else {
|
|
||||||
return $frame;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user