You are here

protected function QPCache::genMultiKey in QueryPath 6

Same name and namespace in other branches
  1. 7.3 qpcache/qpcache.module \QPCache::genMultiKey()
  2. 7.2 qpcache/qpcache.module \QPCache::genMultiKey()

Given the original key, generate a multi-key.

For performance reasons, we use a composite key for retrieving entries. This key uses a CRC-32 checksum against the original key plus an MD5 of the original key. A CRC can be looked up in the database about 30 times faster than an MD5. However, it has a much broader collision space. So if indexing is done correctly, we can use the CRC to very quickly narrow, and then use the MD5 to select the appropriate result from a very small set. .

Return value

List where position 0 is CRC and 1 is MD5

4 calls to QPCache::genMultiKey()
QPCache::get in qpcache/qpcache.module
Return the value of the given key, if it exists in the database.
QPCache::has in qpcache/qpcache.module
Return true if the cache has this key.
QPCache::remove in qpcache/qpcache.module
Remove a single entry from the cache.
QPCache::set in qpcache/qpcache.module
Put a value in the cache.

File

qpcache/qpcache.module, line 302
The main file for qpcache.

Class

QPCache
This is a special-purpose XML cache.

Code

protected function genMultiKey($key) {
  return array(
    crc32($key),
    md5($key),
  );
}