dns.cache: cache-get* word
parent
ce4f8871bf
commit
e14a9ec0fb
|
@ -68,7 +68,7 @@ SYMBOL: NX
|
||||||
|
|
||||||
: expired? ( entry -- ? ) time>> time->ttl 0 <= ;
|
: expired? ( entry -- ? ) time>> time->ttl 0 <= ;
|
||||||
|
|
||||||
: cache-get ( query -- result )
|
: cache-get* ( query -- rrs/NX/f )
|
||||||
dup table-get ! query result
|
dup table-get ! query result
|
||||||
{
|
{
|
||||||
{ [ dup f = ] [ 2drop f ] } ! not in the cache
|
{ [ dup f = ] [ 2drop f ] } ! not in the cache
|
||||||
|
@ -80,6 +80,15 @@ SYMBOL: NX
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
ERROR: name-error name ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
: cache-get ( query -- rrs/f )
|
||||||
|
dup cache-get* dup NX = [ drop name>> name-error ] [ nip ] if ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: rr->entry ( rr -- entry )
|
: rr->entry ( rr -- entry )
|
||||||
[ ttl>> ttl->time ] [ rdata>> {1} >vector ] bi entry boa ;
|
[ ttl>> ttl->time ] [ rdata>> {1} >vector ] bi entry boa ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue