Ejemplo n.º 1
0
Archivo: cache.go Proyecto: cznic/dns
func (c *Cache) get0(name string) (parts rr.Parts, hit, expired bool) {
	var item rr.Bytes
	if item, hit = c.tree.Get(name).(rr.Bytes); hit {
		parts = item.Unpack().Partition(false)
		expired = tidy(time.Now().Unix()-secs0, parts)
		hit = len(parts) != 0
	}
	return
}
Ejemplo n.º 2
0
func TestEnum0(t *testing.T) {
	c := New()
	var hit bool
	var x rr.Bytes
	c.Enum(".", func(path []string, found rr.Bytes) bool {
		x = found
		hit = true
		return false
	})
	if hit {
		t.Fatal(x.Unpack())
	}
}