#185283 - 2008-02-12 03:28 PM
Re: Periodically flushing KiXtart tokencahce example
[Re: Mart]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
Mart:
Good example of automation!
You might want to look at TimeDiff(), since it can simplify this process.
$LastFlush = ReadValue("HKU\" + @SID + "\Software\KiXtart\FlushTokenCache", "DateLastFlush")
If TimeDiff($LastFlush, 'Today', 'D') > 7
;Delete tokencache registry key.
$rc = DelKey ("HKU\" + @SID + "\Software\KiXtart\TokenCache")
;Write now date to the registry for future reference.
$rc = WriteValue("HKU\" + @SID + "\Software\KiXtart\FlushTokenCache", "DateLastFlush", @DATE, "REG_SZ")
EndIf
TimeDiff returns cTime format by default - seconds between the date/time stamps, but you can specify Minutes, Hours, Days, or Years. In this case we use 'D' for Days. It also works with the standard @DATE & @TIME macros, eliminating any fancy time/date formatting.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|