K2hash::setCommonAttribute
Sets the common attributes
Description
public bool K2hash::setCommonAttribute ([ int $is_mtime [, int $is_history [, int $is_encrypt [, string $passfile [, int $is_expire [, int $expire ]]]]]] )
Sets the common attributes. See the attributes in the parameters section.
Parameters
- is_mtime
Specifies true when keeping the last timestamp to modify the value, otherwise false. - is_history
Specifies true to track changes, otherwise false. - is_encrypt
Specifies true to encrypt the value, otherwise false. - passfile
Specifies the file path that contains the password to encrypt the value. - is_expire
Specifies true to expire values, otherwise false. - expire
Specifies the duration in second to expire values.
Return Values
Returns true on success or false on failure.
Examples
- Example 1 - Sets the common attributes
<?php
$k2hash = new K2hash();
$k2hash->openMem();
var_dump($k2hash->setCommonAttribute(K2H_ATTR_ENABLE, K2H_ATTR_ENABLE, K2H_ATTR_DEFAULT, '', K2H_ATTR_ENABLE, 300));
$k2hash->close();
?>
The above example will output:
bool(true)
See Also
- K2hash::addAttr - Adds the attribute to the key
- K2hash::addAttrCryptPass - Adds the password to encrypt values
- K2hash::getAttrInfos - Prints the attribute information
- K2hash::getAttrs - Gets attributes of the key
- K2hash::getAttrValue - Gets an attribute value of the attribute key of the key
- K2hash::getAttrVersionInfos - Prints the attribute library version