@main[]
$sName[164_dir/hf]
^$hf[^^hashfile::open[$sName]]
$hf[^hashfile::open[$sName]]
^checkFiles[$sName]
Storing 4 values and show all items...
^put[$hf;0;value 0;^date::now(+2/24/60/60)]
^put[$hf;1;value 1](2)
^put[$hf;2;value 2](5)
^put[$hf;3;value 3](6)
^print[$hf]
Checking files after storing data...
^checkFiles[$sName]
Removing locks...
^^hf.release[]
^hf.release[]
Removing one value and show all items...
^hf.delete[3]
^print[$hf]
Waiting for a 3 secs and show all items...
^sleep(3)
^print[$hf]
Scan for expired items...
^^hf.cleanup[]
^hf.cleanup[]
^checkFiles[$sName]
Delete files and check if they exists...
^^hf.delete[]
^hf.delete[]
^checkFiles[$sName]
Put value and check auto re-opening...
^put[$hf;1;value 1]
^checkFiles[$sName]
# finalizing: remove files for make next test start working well
^hf.delete[]
@put[hf;sKey;sValue;uExpires]
$hf.$sKey[
$.value[$sValue]
^if(def $uExpires){
^if($uExpires is "date"){
$.expires[$uExpires]
}{
$.expires($uExpires/24/60/60)
}
}
]
@print[hf;sText][sKey;sValue]
^if(def $sText){$sText
}
^hf.foreach[sKey;sValue]{^$hf.${sKey}: '$sValue'}[
]
@checkFiles[sName]
${sName}.dir file ^checkFile[${sName}.dir]
${sName}.pag file ^checkFile[${sName}.dir]
@checkFile[sFileName]
^if(!-f $sFileName){doesn't }exist