acs_mail_lite::inbound_cache_hit_p (private)

 acs_mail_lite::inbound_cache_hit_p email_uid uidvalidity \
    mailbox_host_name

Defined in packages/acs-mail-lite/tcl/email-inbound-procs.tcl

Check email unique id (UID) against history in table. If already exists, returns 1 otherwise 0. Adds checked case to cache if not already there. uidvalidity is defined by imap RFC 3501 2.3.1.1 https://tools.ietf.org/html/rfc3501#section-2.3.1.1 Other protocols have an analog mechanism, or one can be made locally to be equivalent in use.

Parameters:
email_uid
uidvalidity
mailbox_host_name

Partial Call Graph (max 5 caller/called nodes):
%3 acs_mail_lite::imap_check_incoming acs_mail_lite::imap_check_incoming (private) acs_mail_lite::inbound_cache_hit_p acs_mail_lite::inbound_cache_hit_p acs_mail_lite::imap_check_incoming->acs_mail_lite::inbound_cache_hit_p acs_mail_lite::maildir_check_incoming acs_mail_lite::maildir_check_incoming (private) acs_mail_lite::maildir_check_incoming->acs_mail_lite::inbound_cache_hit_p db_0or1row db_0or1row (public) acs_mail_lite::inbound_cache_hit_p->db_0or1row db_dml db_dml (public) acs_mail_lite::inbound_cache_hit_p->db_dml db_nextval db_nextval (public) acs_mail_lite::inbound_cache_hit_p->db_nextval

Testcases:
No testcase defined.
Source code:
    set hit_p 0
    set src_ext $mailbox_host_name
    append src_ext "-" $uidvalidity
    set aml_src_id ""
    db_0or1row -cache_key aml_in_src_id_${src_ext}  acs_mail_lite_email_src_ext_id_map_r1 {
            select aml_src_id from acs_mail_lite_email_src_ext_id_map
            where src_ext=:src_ext }
    if { $aml_src_id eq "" } {
        set aml_src_id [db_nextval acs_mail_lite_in_id_seq]
        db_dml acs_mail_lite_email_src_ext_id_map_c1 {
            insert into acs_mail_lite_email_src_ext_id_map
            (aml_src_id,src_ext)
            values (:aml_src_id,:src_ext)
        }
    }
    set aml_email_id ""
    db_0or1row acs_mail_lite_email_uid_id_map_r1 {
        select aml_email_id from acs_mail_lite_email_uid_id_map
        where uid_ext=:email_uid
        and src_ext_id=:aml_src_id
    }
    if { $aml_email_id eq "" } {
        set aml_email_id [db_nextval acs_mail_lite_in_id_seq]
        db_dml acs_mail_lite_email_uid_id_map_c1 {
            insert into acs_mail_lite_email_uid_id_map
            (aml_email_id,uid_ext,src_ext_id)
            values (:aml_email_id,:email_uid,:aml_src_id)
        }
    } else {
        set hit_p 1
    }
    return $hit_p
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-mail-lite/tcl/email-inbound-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: