@main[][sDir;sName;tList;hf;i]
$sDir[174]
$sName[data]
# remove previous files first
$tList[^file:list[$sDir]]
^tList.menu{
^file:delete[$sDir/$tList.name]
}
# open hashfile
$hf[^hashfile::open[$sDir/$sName]]
# check hashfile files -- it mustn't exist because of delayed opened
^checkFiles[$sDir;$sName]
# add item with key '0' for 2 sec
$hf.0[
$.value[zigi]
$.expires(2/24/60/60)
]
# add more items to hashfile
^for[i](1;9){
$hf.[$i][=$i=]
}
^checkFiles[$sDir;$sName]
^$hf.0: '$hf.0'
# wait 2 secs till item with key '0' expired
^sleep(3)
^$hf.0: '$hf.0'
# release before .foreach
^hf.release[]
keys: ^hf.foreach[k;]{$k}[, ]
# release before .delete
^hf.release[]
^hf.delete[1]
^hf.foreach[k;v]{^$hf.${k}: '$v'
}
^hf.delete[2]
$s[^hf.foreach[k;v]{^$hf.${k}: '$v'}[
]]
$s
# checking for cleanup (just calls: we can't check internals)
^hf.cleanup[]
# delete hashfile
^hf.delete[]
# files mustn't exist after .delete[]
^checkFiles[$sDir;$sName]
# try to read not existing hashfile (it must auto opened)
^hf.foreach[k;v]{^$hf.${k}: '$v'
}
# files must exist now
^checkFiles[$sDir;$sName]
@checkFiles[sDir;sName]
^checkFile[$sDir/${sName}.dir]
^checkFile[$sDir/${sName}.pag]
@checkFile[sFileName]
$sFileName -- ^if(-f $sFileName){exist}{not exist}