blob: 095f24d420d72dab11d7634964ff7b20913e27c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?php
/**
* TSqlMapCacheModel, TSqlMapCacheTypes and TSqlMapCacheKey classes file.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @package System.Data.SqlMap.Configuration
*/
/**
* TSqlMapCacheKey class.
*
* Provides a hash of the object to be cached.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
* @package System.Data.SqlMap.Configuration
* @since 3.1
*/
class TSqlMapCacheKey
{
private $_key;
/**
* @param mixed object to be cached.
*/
public function __construct($object)
{
$this->_key = $this->generateKey(serialize($object));
}
/**
* @param string serialized object
* @return string crc32 hash of the serialized object.
*/
protected function generateKey($string)
{
return sprintf('%x',crc32($string));
}
/**
* @return string object hash.
*/
public function getHash()
{
return $this->_key;
}
}
|