Esempio n. 1
0
// test scribble cache deleteRecord
func TestScribbleDeleteRecord(t *testing.T) {
	scribbleReset()
	err := cache.DeleteRecord("nanobox.io")
	cache.AddRecord(&nanopack)
	err2 := cache.DeleteRecord("nanopack.io")
	if err != nil || err2 != nil {
		t.Errorf("Failed to delete record from scribble cacher - %v%v", err, err2)
	}
}
Esempio n. 2
0
// test nil cache deleteRecord
func TestNoneDeleteRecord(t *testing.T) {
	noneReset()
	err := cache.DeleteRecord("nanopack.io")
	if err != nil {
		t.Errorf("Failed to delete record from none cacher - %v", err)
	}
}
Esempio n. 3
0
// DeleteRecord deletes the resource(domain)
func DeleteRecord(domain string) error {
	sham.SanitizeDomain(&domain)

	// update cache
	config.Log.Trace("Removing record from persistent cache...")
	err := cache.DeleteRecord(domain)
	if err != nil {
		return err
	}

	// todo: atomic
	delete(Answers, domain)

	// otherwise, be idempotent and report it was deleted...
	return nil
}