You are here

public static function UniqueDatabaseQueue::hash in Queue Unique 8.2

Generate a hashed string from a queue name and serialized data.

Parameters

string $name: The queue name.

string $serialized_data: The serialized data.

Return value

string The hash string.

2 calls to UniqueDatabaseQueue::hash()
queue_unique_update_8001 in ./queue_unique.install
Migrate existing queue data to a new table.
UniqueDatabaseQueue::doCreateItem in src/UniqueDatabaseQueue.php
Adds a queue item and store it directly to the queue.

File

src/UniqueDatabaseQueue.php, line 65

Class

UniqueDatabaseQueue
Database queue implementation which only adds unique items.

Namespace

Drupal\queue_unique

Code

public static function hash($name, $serialized_data) {
  $substr_length = static::HASH_COL_LENGTH - strlen(static::HASH_ID);
  return static::HASH_ID . substr(base64_encode(hash('sha512', $name . $serialized_data, TRUE)), 0, $substr_length);
}