whos_online::flush (private)

 whos_online::flush

Defined in packages/acs-tcl/tcl/whos-online-procs.tcl

Removing all user_ids from the last_hit (nsv_set) which have a timestamp older than the number of seconds indicated by the proc whos_online::interval.

Author:
Bjoern Kiesbye

Partial Call Graph (max 5 caller/called nodes):
%3 whos_online::interval whos_online::interval (public) whos_online::flush whos_online::flush whos_online::flush->whos_online::interval

Testcases:
No testcase defined.
Source code:
    array set last_hit [nsv_array get last_hit]
    set onliners_out [list]
    set interval 1
    set oldtime [expr {[ns_time] - [interval]}]

    for { set search [array startsearch last_hit] } { [array anymore last_hit $search] } {} {
        set user [array nextelement last_hit $search]
        set time $last_hit($user)
        if {$time<$oldtime} {
            lappend onliners_out $user
        }
    }

    array donesearch last_hit $search

    for { set i 0 } { $i < [llength $onliners_out] } { incr i } {
        set user_id [lindex $onliners_out $i]
        foreach name { last_hit invsible_users first_hit } {
            if { [nsv_exists $name $user_id] } {
                nsv_unset $name $user_id
            }
        }
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: